django comment: how to specify the sort direction?
I am using comment app in django, but currently the sort directio开发者_JS百科n is by date(from old to new), I want the comments are displayed by date from new to old, how to change it?
you can do:
{% get_comment_list for event as comment_list %}
{% for comment in comment_list reversed %}
...
{% endfor %}
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for
You can use the minus sign to inverse the ordering.
t = Theme.objects.order_by('-pub_date')
Avoid using business logic in the templates as much as possible.
the django documentation
精彩评论