Customizing an Admin form in Django while also using autodiscover Customizing an Admin form in Django while also using autodiscover python python

Customizing an Admin form in Django while also using autodiscover


None of the above. Just use admin.site.unregister(). Here's how I recently added filtering Users on is_active in the admin (n.b. is_active filtering is now on the User model by default in Django core; still works here as an example), all DRY as can be:

from django.contrib import adminfrom django.contrib.auth.admin import UserAdminfrom django.contrib.auth.models import Userclass MyUserAdmin(UserAdmin):    list_filter = UserAdmin.list_filter + ('is_active',)admin.site.unregister(User)admin.site.register(User, MyUserAdmin)


I think it might be easier to do this with a custom auth backend and thus remove the need for a customized ModelAdmin.

I did something similar with this snippet:http://www.djangosnippets.org/snippets/74/