]>
Commit | Line | Data |
---|---|---|
1 | """Integrate with admin module.""" | |
2 | ||
3 | from django.contrib import admin | |
4 | from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin | |
5 | from django.utils.translation import ugettext_lazy as _ | |
6 | ||
7 | from .models import User | |
8 | ||
9 | ||
10 | @admin.register(User) | |
11 | class UserAdmin(DjangoUserAdmin): | |
12 | """Define admin model for custom User model with no email field.""" | |
13 | ||
14 | fieldsets = ( | |
15 | (None, {'fields': ('email', 'password')}), | |
16 | (_('Personal info'), {'fields': ('first_name', 'last_name','fortnox_external_id')}), | |
17 | (_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser', | |
18 | 'groups', 'user_permissions')}), | |
19 | (_('Important dates'), {'fields': ('last_login', 'date_joined')}), | |
20 | ) | |
21 | add_fieldsets = ( | |
22 | (None, { | |
23 | 'classes': ('wide',), | |
24 | 'fields': ('email', 'password1', 'password2'), | |
25 | }), | |
26 | ) | |
27 | list_display = ('email', 'first_name', 'last_name', 'is_staff') | |
28 | search_fields = ('email', 'first_name', 'last_name') | |
29 | ordering = ('email',) |