Fakultas Ilmu Komputer UI

Commit f1562644 authored by Nabila Febri Viola's avatar Nabila Febri Viola
Browse files

[REFACTOR] Customize profile admin

parent aa1867a2
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', ]
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