I try to sort a post list in Django. I read that you have to use .order_by('-fecha')
. I have tried the following in the template:
{% for post in persona.post_set.all.order_by('-fecha') %}
{{ post.texto }}<br>
{% endfor %}
But it returns this error:
Could not parse the remainder: '(-date)' from 'person.post_set.all.order_by (-date)'
How could I sort the post so that the last post that was posted is the first one?