You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.3 KiB
35 lines
1.3 KiB
# -*- coding: utf-8 -*-
|
|
from django.contrib import admin
|
|
from django.contrib.auth.admin import UserAdmin
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from models import DokUser
|
|
from forms import CustomUserChangeForm, CustomUserCreationForm
|
|
|
|
|
|
class CustomUserAdmin(UserAdmin):
|
|
# The forms to add and change user instances
|
|
|
|
# The fields to be used in displaying the User model.
|
|
# These override the definitions on the base UserAdmin
|
|
# that reference the removed 'username' field
|
|
fieldsets = (
|
|
(None, {'fields': ('username', 'email', 'password')}),
|
|
(_('Personal info'), {'fields': ('first_name', 'last_name', 'profile')}),
|
|
(_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser',
|
|
'groups', 'user_permissions')}),
|
|
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
|
|
)
|
|
add_fieldsets = (
|
|
(None, {
|
|
'classes': ('wide',),
|
|
'fields': ('username', 'email', 'password1', 'password2')}
|
|
),
|
|
)
|
|
form = CustomUserChangeForm
|
|
add_form = CustomUserCreationForm
|
|
list_display = ('username', 'email', 'first_name', 'last_name', 'is_staff', 'date_joined')
|
|
search_fields = ('username', 'email', 'first_name', 'last_name')
|
|
ordering = ('email',)
|
|
|
|
admin.site.register(DokUser, CustomUserAdmin)
|
|
|