Commit 32618fa0 by Brian Mesick Committed by GitHub

Merge pull request #15495 from edx/bmedx/admin-site-register-PLAT-1631

Ensure User model is unregistered before registering with Django admin
parents 292502ba cfb53a35
""" Django admin pages for student app """
from config_models.admin import ConfigurationModelAdmin
from django import forms
from django.contrib.admin.sites import NotRegistered
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.utils.translation import ugettext_lazy as _
......@@ -207,4 +208,9 @@ admin.site.register(RegistrationCookieConfiguration, ConfigurationModelAdmin)
# We must first un-register the User model since it may also be registered by the auth app.
try:
admin.site.unregister(User)
except NotRegistered:
pass
admin.site.register(User, UserAdmin)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment