On Wed, Aug 7, 2013 at 6:59 PM, Pepsodent Cola <pepsodentc...@gmail.com> wrote:
> How come when I replace this:
>     {% for choice2 in poll.altword_set.all %}
> to this:
>     {% for choice2 in poll.altword_set.all().order_by('-votes')  %}
> then I get this error:
>
> Exception Type: TemplateSyntaxError
> Exception Value:
>
> Could not parse the remainder: '().order_by('-votes')' from
> 'poll.altword_set.all().order_by('-votes')'
>
>
>
> How do I write the correct syntax for ordering my list?

You can't. The template language only supports calling methods without
arguments, and in that case the () aren't needed.

Please read this section of the documentation fully for more details:

https://docs.djangoproject.com/en/1.5/topics/templates/#accessing-method-calls

You will need to implement the ordering with a method in another layer
and invoke it from the template layer.

Regards,

--
Ramiro Morales
@ramiromorales

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to