1
0
mirror of https://github.com/django/django.git synced 2024-11-18 15:34:16 +00:00
django/tests/auth_tests/urls_custom_user_admin.py
Marten Kenbeek 1e82094f1b Fixed #21927 -- Made application and instance namespaces more distinct.
Made URL application namespaces be set in the included URLconf and
instance namespaces in the call to include(). Deprecated other ways
to set application and instance namespaces.
2015-06-08 15:12:20 -04:00

21 lines
635 B
Python

from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin
site = admin.AdminSite(name='custom_user_admin')
class CustomUserAdmin(UserAdmin):
def log_change(self, request, object, message):
# LogEntry.user column doesn't get altered to expect a UUID, so set an
# integer manually to avoid causing an error.
request.user.pk = 1
super(CustomUserAdmin, self).log_change(request, object, message)
site.register(get_user_model(), CustomUserAdmin)
urlpatterns = [
url(r'^admin/', site.urls),
]