Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
2020
PPL-C
Diskominfo-D'Blood
Mantan Aab-D Blood
Commits
f1562644
Commit
f1562644
authored
Jun 08, 2020
by
Nabila Febri Viola
Browse files
[REFACTOR] Customize profile admin
parent
aa1867a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/main/admin.py
View file @
f1562644
from
django.contrib
import
admin
from
django.conf
import
settings
from
django.contrib.auth.admin
import
UserAdmin
as
DjangoUserAdmin
from
django.utils.translation
import
ugettext_lazy
as
_
...
...
@@ -12,7 +13,8 @@ class UserAdmin(DjangoUserAdmin):
fieldsets
=
(
(
None
,
{
'fields'
:
(
'email'
,
'password'
)}),
(
_
(
'Personal info'
),
{
'fields'
:
(
'first_name'
,
'last_name'
)}),
(
_
(
'Permissions'
),
{
'fields'
:
(
'is_active'
,
'is_staff'
,
'is_superuser'
,
'is_verified'
,
(
_
(
'Permissions'
),
{
'fields'
:
(
'is_active'
,
'is_staff'
,
'is_superuser'
,
'is_verified'
,
'groups'
,
'user_permissions'
)}),
(
_
(
'Important dates'
),
{
'fields'
:
(
'last_login'
,
'date_joined'
)}),
)
...
...
@@ -29,4 +31,55 @@ class UserAdmin(DjangoUserAdmin):
@
admin
.
register
(
Profile
)
class
ProfileAdmin
(
admin
.
ModelAdmin
):
pass
list_display
=
(
'user'
,
'district'
,
'address'
,
'age'
,
'sex'
,
'blood_type'
)
list_filter
=
(
'blood_type'
,
'sex'
)
search_fields
=
(
'address'
,
'district'
)
readonly_fields
=
(
'user'
,
'body_weight'
,
'id_card_no'
,
'birthplace'
,
'birthdate'
,
'sex'
,
'profession'
,
'blood_type'
,
'married_status'
,
'address'
,
'city'
,
'district'
,
'village'
,
'phone_no'
,
'work_address'
,
'work_email'
,
'work_phone_no'
,
'age'
)
fieldsets
=
(
(
None
,
{
'fields'
:
(
'user'
,)}),
(
'INFORMASI PRIBADI'
,
{
'fields'
:
(
'id_card_no'
,
'birthplace'
,
'birthdate'
,
'age'
,
'body_weight'
,
'sex'
,
'profession'
,
'blood_type'
,
'married_status'
)
}),
(
'ALAMAT'
,
{
'fields'
:
(
'address'
,
'village'
,
'district'
,
'city'
,
'work_address'
)
}),
(
'KONTAK'
,
{
'fields'
:
(
'phone_no'
,
'work_email'
,
'work_phone_no'
)
}),
)
class
Media
:
js
=
[
settings
.
MEDIA_URL
+
'/js/profile_custom_admin.js'
,
]
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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