开发者

Django admin select box ordering

开发者 https://www.devze.com 2023-01-27 05:14 出处:网络
How to order for开发者_运维技巧eign key values in Django admin? ex: class LeaveBase(models.Model):

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

精彩评论

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