Django’s admin site is a great tool throughout development. Django also provides an authentication module that also reduces the development time. The problem is that the auth module predefines the admin classes that shows a very simplistic listing in the admin view.
It is not easy to see how you can customize this. But if you read through
django.contrib.admin.sites then the answers becomes clearer. You can unregister the existing class for the User model and register your own version. Below is what this translates to, put this code in one of your application’s
admin.py (if you are calling admin.autodiscover in
1 2 3 4 5 6 7 8 9
from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User class CustomUserAdmin(UserAdmin): list_display = ('id', 'username', 'email', 'first_name', 'last_name', 'is_staff', 'date_joined', 'is_active') ordering = ['-date_joined'] admin.site.unregister(User) admin.site.register(User, CustomUserAdmin)
This will result in the following view.
There you have it, a custom view to speed up your development even further 🙂