admin getting confused by "order_by" statements.
|Reported by:||terry@…||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||no|
Here are two simple models. When I try to bring up the admin UI for the "Faq" model, it crashes. The crash seems to show that it is somehow incorrectly getting the "order_by" entry from the FaqCategory class.
class FaqCategory(models.Model): name = models.CharField(maxlength=255) sortkey = models.IntegerField(default=0) def __str__(self): return "[Sortkey %d] %s" % (self.sortkey, self.name) class Admin: pass class Meta: ordering = ['sortkey', 'name'] class Faq(models.Model): category = models.ForeignKey(FaqCategory) sortkey = models.IntegerField(default=0) question = models.TextField() answer = models.TextField() def __str__(self): return "[Sortkey %d] %s" % (self.sortkey, self.question) class Admin: pass class Meta: ordering = ['category', 'sortkey', 'question'] unique_together = (('category', 'sortkey', 'question'),)
This bug seems very similar to the one described in ticket 1547, but that one claims to be fixed.
Change History (13)
comment:2 Changed 7 years ago by ubernostrum
- Resolution set to duplicate
- Status changed from new to closed
Changed 7 years ago by ramiro <rm0 _at_ gmx.net>
comment:4 Changed 7 years ago by Gary Wilson <gary.wilson@…>
- Has patch set
- Keywords reopen added
- Needs tests set
- Triage Stage changed from Unreviewed to Accepted
comment:5 Changed 7 years ago by jacob
- Resolution duplicate deleted
- Status changed from closed to reopened