해결됨: .comments.all django 주문

마지막 업데이트 : 09/11/2023

기여.댓글

댓글과 관련된 주요 문제는 사이트 방문자에게 혼란과 좌절의 원인이 될 수 있다는 것입니다. 댓글은 관리하기 어려울 수 있으며 어떤 댓글이 아직 활성 상태이고 어떤 댓글이 삭제되었는지 추적하기 어려울 수 있습니다.

,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...

Django의 두 기존 테이블 간에 ManyToMany 관계를 만드는 방법은 무엇입니까? django,django-models,many-to-many 내 Django 앱에는 ManyToMany 관계를 통해 연결해야 하는 2개의 테이블이 있는 기존 데이터베이스가 있습니다. class ProductType(models.Model): product_type_id = models.AutoField(primary_key=True) product_type …

Django – 두 개의 기존 테이블 간에 ManyToMany 관계를 어떻게 생성합니까? django,django-models,many-to-many 내 Django 앱에는 ManyToMany 관계를 통해 연결해야 하는 2개의 테이블이 있는 기존 데이터베이스가 있습니다. class ProductType(models.Model): product_type_id = models.AutoField(primary_key=True) product_type …

댓글 수 순으로 정렬

프로젝트의 특정 요구 사항에 따라 달라지므로 이 질문에 대한 명확한 답은 없습니다. 그러나 한 가지 접근 방식은 댓글 수에 따라 댓글을 정렬하는 것입니다.

쿼리셋 순서

Django에서 QuerySet의 순서는 개체가 QuerySet에 추가된 순서에 따라 결정됩니다.

관련 게시물: