มีส่วนร่วม.comments
ปัญหาหลักเกี่ยวกับความคิดเห็นคืออาจทำให้เกิดความสับสนและความยุ่งยากสำหรับผู้เยี่ยมชมไซต์ ความคิดเห็นอาจจัดการได้ยาก และติดตามได้ยากว่าความคิดเห็นใดยังคงใช้งานอยู่และความคิดเห็นใดถูกลบไปแล้ว
,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...
จะสร้างความสัมพันธ์ ManyToMany ระหว่างสองตารางที่มีอยู่ใน Django ได้อย่างไร django,django-models,many-to-many แอป Django ของฉันมีฐานข้อมูลที่มีอยู่ซึ่งมี 2 ตารางที่ต้องเชื่อมต่อผ่านความสัมพันธ์ ManyToMany: class ProductType(models.Model): product_type_id = models.AutoField(primary_key=True) product_type …
Django – คุณจะสร้างความสัมพันธ์ ManyToMany ระหว่างสองตารางที่มีอยู่ได้อย่างไร django,django-models,many-to-many แอป Django ของฉันมีฐานข้อมูลที่มีอยู่ซึ่งมี 2 ตารางที่ต้องเชื่อมต่อผ่านความสัมพันธ์ ManyToMany: class ProductType(models.Model): product_type_id = models.AutoField(primary_key=True) product_type …
สั่งซื้อตามจำนวนความคิดเห็น
ไม่มีคำตอบที่ชัดเจนสำหรับคำถามนี้ เนื่องจากขึ้นอยู่กับความต้องการเฉพาะของโครงการของคุณ อย่างไรก็ตาม วิธีหนึ่งคือจัดลำดับความคิดเห็นตามจำนวนความคิดเห็นที่พวกเขามี
คำสั่งชุดแบบสอบถาม
ลำดับของ QuerySet ใน Django ถูกกำหนดโดยลำดับที่วัตถุถูกเพิ่มไปยัง QuerySet