Fakultas Ilmu Komputer UI

Commit 9230f935 authored by Kefas Satrio Bangkit Solidedantyo's avatar Kefas Satrio Bangkit Solidedantyo
Browse files

Merge branch 'user-creation-form-in-admin' into 'staging'

User form in admin

See merge request !64
parents 2e66621b 1530b491
Pipeline #76471 passed with stages
in 12 minutes and 9 seconds
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
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