>From Stackoverflow - How do I perform query filtering in django 
>templates<http://stackoverflow.com/questions/223990/how-do-i-perform-query-filtering-in-django-templates>
:

You can't do this, which is by design. The Django framework authors intended 
a strict separation of presentation code from data logic. Filtering models 
is data logic, and outputting HTML is presentation logic.

So you have several options. The easiest is to do the filtering, then pass 
the result to render_to_response. Or you could write a method in your model 
so that you can say {% for object in data.filtered_set %}. Finally, you 
could write your own template tag, although in this specific case I would 
advise against that.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to