Thanks ..
On Mar 27, 1:15 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Thu, Mar 27, 2008 at 1:12 AM, django <[EMAIL PROTECTED]> wrote:
> > How do i convert {{ candidate.vote_set.filter(vote='TU').count()}} in
> > my view_candidate to work it properly ????
> > Right now it give me templatesyntax error
>
> Quoting the "Philosophy" section at the top of this page:
>
> http://www.djangoproject.com/documentation/templates/
>
> ------------------
>
> "If you have a background in programming, or if you're used to
> languages like PHP which mix programming code directly into HTML,
> you'll want to bear in mind that the Django template system is not
> simply Python embedded into HTML. This is by design: the template
> system is meant to express presentation, not program logic."
>
> "The Django template system provides tags which function similarly to
> some programming constructs -- an {% if %} tag for boolean tests, a {%
> for %} tag for looping, etc. -- but these are not simply executed as
> the corresponding Python code, and the template system will not
> execute arbitrary Python expressions. Only the tags, filters and
> syntax listed below are supported by default (although you can add
> your own extensions to the template language as needed)."
>
> ------------------
>
> This suggests an answer to why the things you're trying don't work
> (the template system isn't just Python mixed into HTML, and so
> arbitrary Python function calls don't work), and offers some ideas on
> where to turn to get something that works (write a custom tag or, if
> this is a common need, write a custom method on your model which
> returns the value you want).
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---