admin.py
1.14 KB
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import gettext as _
from usuario.models import Usuario
@admin.register(Usuario)
class UsuarioAdmin(UserAdmin):
fieldsets = (
(None, {'fields': ('username', 'password')}),
(_('Personal info'),
{
'fields': (
'first_name',
'last_name',
'email',
'documento_identidad'
)
}),
(_('Organismo'), {'fields': ('organismo',)}),
(_('Permissions'), {
'fields': ('is_active', 'is_staff', 'is_superuser', 'groups', 'user_permissions'),
}),
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)
add_fieldsets = (
(None, {
'classes': ('wide',),
'fields': (
'first_name', 'last_name', 'username', "password1", "password2", 'email', 'documento_identidad',
'organismo', 'is_staff',)}
),
)
search_fields = ('email', 'documento_identidad', 'username',)
autocomplete_fields = ('organismo',)