On Jan 16, 12:45 pm, Gath <pgath...@gmail.com> wrote:
> Guys,
>
> I might be lazy or am blind! but the following code is returning ZERO!
> items, while very well i know there is some items in the list,
>
> View:
> def post_answer(request, quest_id=None):
>     answer_list = Answer.objects.filter
> (questionis__pk=quest_id).select_related()
>     ...
>     # if a put a print stmt here ( answer_list[0].answer ) there is
> data from the console!!
>
>     return render_to_response('myapp/post_answer.html',
> {'answerobj':answer_list }} )
>
> Template post_answer.html:
>
> {% regroup answerobj.object_list by answer as ans_list %}{{ ans_list|
> length }}
> ....
>
> the above code prints 0.
>
> I must be goofing somewhere, pls assist
>
> Paul

Where is the 'object_list' attribute of answerobj coming from? As far
as I can see, answerobj is a queryset, and doesn't have any such
attribute. Since templates don't give an error when accessing non-
existent attributes, it's probably just passing None into the regroup
tag, so of course the length is 0.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to