Search code examples
djangodjango-modelsdjango-comments

Reorder comments from django comments framework in reverse order


I would like to reorder my comments to display newest first. I am using the built in Django comments framework. Is there a built in, or easy way to do this?


Solution

  • From the Django docs:

    You can loop over a list in reverse by using {% for obj in list reversed %}.
    

    So, in my template I have:

    {% for comment in comment_list reversed %}
    

    Your comments are now in reverse.