以下是模型:
TYPE_CHOICES = (
('x','Some X'),
('y','Some Y'),
('z', 'Some Z'),
)
class MyModel(models.Model):
some_type = models.CharField(max_length=1, choices=TYPE_CHOICES)
desc = models.TextField()
date_added = models.DateFimeField()
我想首先获得some_type='x'
的记录,然后是其他记录(在每个“组”中按date_added
排序)