Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
2021
Kelas D
PT Gizi Sehat - Dietela
Dietela Backend
Commits
1530b491
Commit
1530b491
authored
May 11, 2021
by
Glenda Emanuella Sutanto
Committed by
Kefas Satrio Bangkit Solidedantyo
May 11, 2021
Browse files
User form in admin
parent
2e66621b
Changes
1
Hide whitespace changes
Inline
Side-by-side
authentication/admin.py
View file @
1530b491
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
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment