brad wrote:
> When I am in  "manage.py shell", I import the model Data and I
> execute Data.objects.all(), what is returned to me are all of the
> prices in the database table.

Actually, that returns a list of Data instances.  You've told Django
(via the __str__ method in class Data) that it should display a data
instance as its price.  You can still access the instances' other
properties:

    for datum in Data.objects.all():
        print datum.quantity.name

> For example, if the user selects the quantity who's
> id has a value of 25, then I want to search the database for every row
> who's quantity field == 25 and return the rows, which should include a
> price, a company, and a url. Any ideas as to how I can accomplish this?

Something like this:

    quantity = Quantity.objects.get(pk=25)
    for data in quantity.data_set.all():
        print '%s %s %s' % (data.price, data.company, data.url)

-Zak

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to