admin.py 867 Bytes
Newer Older
fred's avatar
fred committed
1
from django.contrib import admin
2 3
import django.contrib.auth.admin
from django.utils.translation import ugettext, ugettext_lazy as _
fred's avatar
fred committed
4 5

from .models import User
6 7 8 9 10 11 12
from .forms import UserChangeForm

class UserAdmin(django.contrib.auth.admin.UserAdmin):
    form = UserChangeForm
    fieldsets = (
        (None, {'fields': ('username', 'password')}),
        (_('Personal info'), {'fields': ('first_name', 'last_name', 'email',
fred's avatar
fred committed
13
                'phone', 'mobile',
14 15 16 17 18
                'emissions', 'news_categories')}),
        (_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser',
                                       'groups', 'user_permissions')}),
        (_('Important dates'), {'fields': ('last_login', 'date_joined')}),
    )
fred's avatar
fred committed
19
    filter_horizontal = ('groups', 'user_permissions', 'emissions', 'news_categories')
fred's avatar
fred committed
20 21 22


admin.site.register(User, UserAdmin)