2020-12-28 20:28:52 +01:00
|
|
|
from django.contrib import admin
|
2020-12-29 23:26:10 +01:00
|
|
|
from django.contrib.auth.admin import UserAdmin
|
2020-12-28 20:28:52 +01:00
|
|
|
|
2020-12-29 23:26:10 +01:00
|
|
|
from .models import Account
|
|
|
|
|
|
|
|
|
|
|
|
class MyAdminAccounts(UserAdmin):
|
|
|
|
model = Account
|
|
|
|
list_display = ('email', 'first_name', 'last_name', 'is_employee', 'is_employer')
|
|
|
|
list_filter = ('email', 'first_name', 'last_name', 'is_employee', 'is_employer')
|
|
|
|
search_fields = ('email', 'first_name', 'last_name')
|
|
|
|
ordering = ('email', 'first_name')
|
|
|
|
readonly_fields = ['date_joined']
|
|
|
|
|
|
|
|
add_fieldsets = (
|
|
|
|
(None, {
|
|
|
|
'classes': ('wide',),
|
|
|
|
'fields': ('email', 'first_name', 'last_name', 'password1', 'password2',
|
|
|
|
'is_employee', 'is_employer', 'is_active')
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
fieldsets = (
|
|
|
|
(None, {'fields': ('email', 'first_name', 'last_name', 'password')}),
|
|
|
|
('Permissions', {'fields': ('is_staff', 'is_active', 'is_employee', 'is_employer')})
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
admin.site.register(Account, MyAdminAccounts)
|