Solved: .comments.all order django

contrib.comments

The main problem related to comments is that they can be a source of confusion and frustration for site visitors. Comments can be difficult to manage, and it can be difficult to keep track of which comments are still active and which have been deleted.

,django-templates,django-views I have a model with comments. I want to display the comments in reverse order (most recent first). I tried this: {% for comment in article.comments.all %} {{ comment }} {% endfor %} But it doesn't work...

Django - How to get all objects from a model that are not related to another model? django,django-models,many-to-many I have two models: class Team(models.Model): name = models.CharField(max_length=100) class Player(models.Model): name = models.CharField(max_length=100) teams = models.ManyToManyField('Team') So every player can be...

Django - How do you create a ManyToMany relationship between two existing tables? django,django-models,many-to-many My Django app has an existing database with 2 tables that need to be connected via a ManyToMany relationship: class ProductType(models.Model): product_type_id = models.AutoField(primary_key=True) product_type...

How to create a ManyToMany relationship between two existing tables in Django? django,django-models,many-to-many My Django app has an existing database with 2 tables that need to be connected via a ManyToMany relationship: class ProductType(models.Model): product_type_id = models.AutoField(primary_key=True) product_type…

Django – How do you create a ManyToMany relationship between two existing tables? django,django-models,many-to-many My Django app has an existing database with 2 tables that need to be connected via a ManyToMany relationship: class ProductType(models.Model): product_type_id = models.AutoField(primary_key=True) product_type…

Order by the amount of comments

There is no definitive answer to this question as it depends on the specific needs of your project. However, one approach would be to order comments by the number of comments they have.

QuerySet Order

The order of a QuerySet in Django is determined by the order in which the objects were added to the QuerySet.

Related posts:

Leave a Comment