Django Admin: Ordering of ForeignKey and ManyToManyField relations referencing User

后端 未结 4 1138
情书的邮戳
情书的邮戳 2020-11-30 04:42

I have an application that makes use of Django\'s UserProfile to extend the built-in Django User model. Looks a bit like:

class Us         


        
4条回答
  •  借酒劲吻你
    2020-11-30 05:41

    This might be dangerous for some reason, but this can be done in one line in your project's models.py file:

    User._meta.ordering=["username"]
    

提交回复
热议问题