Fakultas Ilmu Komputer UI

Commit 1530b491 authored by Glenda Emanuella Sutanto's avatar Glenda Emanuella Sutanto Committed by Kefas Satrio Bangkit Solidedantyo
Browse files

User form in admin

parent 2e66621b
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from .models import CustomUser from .models import CustomUser
admin.site.register(CustomUser)
class UserAdmin(BaseUserAdmin):
# The fields to be used in displaying the User model.
# These override the definitions on the base UserAdmin
# that reference specific fields on auth.User.
list_display = ('email',)
fieldsets = (
(None, {'fields': (\
'name',
'email',
'password',
'groups',
'diet_profile',
'nutritionist',
'date_joined',
'is_staff',
'is_active',
'is_superuser',
'user_permissions',
'last_login'
)}),
)
# add_fieldsets is not a standard ModelAdmin attribute. UserAdmin
# overrides get_fieldsets to use this attribute when creating a user.
add_fieldsets = (
(None, {
'classes': ('wide',),
'fields': (\
'name',
'email',
'password1',
'password2',
'groups',
'diet_profile',
'nutritionist',
'date_joined',
'is_staff',
'is_active',
'is_superuser',
'user_permissions',
'last_login'
)}
),
)
search_fields = ('email',)
ordering = ('email',)
admin.site.register(CustomUser, UserAdmin)
Supports Markdown
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