开发者

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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜