admin.py 832 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 13 14 15 16 17
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',
                '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
18
    filter_horizontal = ('groups', 'user_permissions', 'emissions', 'news_categories')
fred's avatar
fred committed
19 20 21


admin.site.register(User, UserAdmin)