Django管理员:根据FK'd属性进行内联排序
我有一个简单的Django摄影比赛应用程序,它有三个简单的模型定义:
class Person(models.Model):
    name = models.CharField(unique=True, max_length=255)
    id = models.AutoField(primary_key=True)
    class Meta:
        db_table = u'people'
    def __unicode__(self):
        return self.name
class Round(models.Model):
    theme = models.CharField(max_length=255)
    number = models.IntegerField()
    id = models.AutoField(primary_key=True)
    class Meta:
        db_table = u'rounds'
    def __unicode__(self):
        return self.season.name+" - "+self.theme
class Entry(models.Model):
    rank = int
    total_score = models.SmallIntegerField()
    id = models.AutoField(primary_key=True)
    person = models.ForeignKey(Person, db_column='person')
    round = models.ForeignKey(Round, db_column='round')
  Round有多个Entry对象,每个Entry都有一个Person 。  一个Person显然可以有多个Entrys进入不同的Rounds 。 
  在管理员视图中,我希望能够选择一个Round Entry查看内嵌Entry的详细信息。  我可以这样做: 
class EntryInline(admin.TabularInline):
    model = Entry
    fields = ['comments','person','total_score','image']
    readonly_fields = ['person','image']
    extra = 0
class RoundAdmin(admin.ModelAdmin):
    fields = ['theme','number']
    inlines = [EntryInline]
  不过,这似乎是任意排序的Entry 。  我可以在EntryInline类中使用django的新ordering关键字来指定订单应该在个人上,但这是由人员Id属性命令而不是他们的name属性。 
  如何在FK'd Person.name属性上内联这个命令? 
将其添加到EntryInline类中: 
ordering = ["person__name"]
