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
9230f935
Commit
9230f935
authored
May 11, 2021
by
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
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
authentication/admin.py
View file @
9230f935
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
)
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