2015-05-28 15:25:52 +00:00
|
|
|
from django.conf.urls import url
|
2015-02-12 17:14:19 +00:00
|
|
|
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.
|
2015-09-03 00:50:34 +00:00
|
|
|
original_pk = request.user.pk
|
2015-02-12 17:14:19 +00:00
|
|
|
request.user.pk = 1
|
|
|
|
super(CustomUserAdmin, self).log_change(request, object, message)
|
2015-09-03 00:50:34 +00:00
|
|
|
request.user.pk = original_pk
|
2015-02-12 17:14:19 +00:00
|
|
|
|
|
|
|
site.register(get_user_model(), CustomUserAdmin)
|
|
|
|
|
2015-05-19 09:10:04 +00:00
|
|
|
urlpatterns = [
|
2015-05-28 15:25:52 +00:00
|
|
|
url(r'^admin/', site.urls),
|
2015-02-12 17:14:19 +00:00
|
|
|
]
|