Commit 8ee3262a authored by gab's avatar gab

modified django-admin to consider email, not password

parent 24dcbd38
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin
from .forms import CustomUserCreationForm
from .models import CustomUser
# Register your models here.
@admin.register(CustomUser)
class UserAdmin(DjangoUserAdmin):
add_form = CustomUserCreationForm
# form = CustomUserChangeForm
model = CustomUser
fieldsets = (
(None, {'fields': ('email', 'password')}),
(('Personal info'), {'fields': ('first_name', 'last_name')}),
(('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser',
'groups', 'user_permissions')}),
(('Important dates'), {'fields': ('last_login', 'date_joined')}),
)
add_fieldsets = (
(None, {
'classes': ('wide',),
'fields': ('email', 'password1', 'password2'),
}),
)
list_display = ('email', 'first_name', 'last_name', 'is_staff')
search_fields = ('email', 'first_name', 'last_name')
ordering = ('email',)
# admin.site.register(CustomUser, CustomUserAdmin)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment