Alternatively you can create a templatetag to accomplish this.

On Mar 27, 3:14 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Thu, Mar 27, 2008 at 3:52 PM, django <[EMAIL PROTECTED]> wrote:
>
> >  Hi,
> >  I want to use {[candidate.vote_set.filter(vote='TU').count()}} in my
> >  template but not able to do it.
>
> >  Its says Templatesyntaxerror...
> >  I want to know how I can use the above exp in my template??
>
> You can't. Django's template language isn't a fully-fledged Python
> interpreter - you can't just put arbitrary python code into a template
> and hope that it evaluates.
>
> If you need to get the value of
> candidate.vote_set.filter(vote='TU').count() into your template, then
> you need to put that expression into your template context; then, you
> can render the evaluated expression in the template.
>
> Yours,
> Russ Magee %-)
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to