Django admin select box ordering
How to order for开发者_运维技巧eign key values in Django admin?
ex:
class LeaveBase(models.Model):
User = models.ForeignKey(User,verbose_name=('User Name'))
FinancialYear=models.ForeignKey(FinancialYear,verbose_name=('Financial Year'))
In my Django admin when i add a new leavebase the User column shows as select box with the default ordering by id, I would like to order by its name.
this may help: http://www.djangoproject.com/documentation/models/ordering/
精彩评论