27👍
✅
Set ModelAdmin.ordering = ('foo', )
to order your admin.
Example
class TeamRoleAdmin(admin.ModelAdmin):
""" Team Role admin view with modifications """
model = TeamRole
ordering = ('team', 'role', 'user')
list_display = ['id', 'user', 'team', 'role']
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.ordering
Modify global model meta class, override ModelAdmin.queryset, there are many ways but you most likely want the Admin ordering.
- How can I change the URL to the Django admin interface?
- How to create a django ViewFlow process programmatically
- Tastypie filtering with multiple values
Source:stackexchange.com