如何以编程方式获取ordering
为Django模型model.Meta
或实例定义的class
?
即。我想从('foo', 'bar')
获得:
class FooBar(models.Model):
foo = models.IntegerField()
bar = models.IntegerField()
snake = models.CharField(max_length=128)
class Meta:
ordering = ('foo', 'bar')
models.FooBar
和models.FooBar.Meta
都没有属性ordering
答案 0 :(得分:1)