c = Choice.objects.filter(choice__startswith='Just') results in a
queryset (not a single object).
you could do:
for obj in c:
obj.poll
you have to loop through the items/objects of the queryset, before
getting the related poll-object.
btw: c[0].poll should also work.
On Aug 31, 12:15
Howdy Artemis,
> >>> c = Choice.objects.filter(choice__startswith='Just')
> >>> c.poll
>
> Traceback (most recent call last):
> File "", line 1, in
> AttributeError: 'QuerySet' object has no attribute 'poll'
Here is what is happening to you. Choice.objects.filter() returns a
QuerySet, not a
Hello,
I am starting out with Django and was trying out the tutorial. I was
running the code through the shell as given in the document. But to my
surprise, I found an anomaly. The tutorial mentions that the Poll
object can access the Choice object and vice versa. The code given is
>>> c =
3 matches
Mail list logo