jobportal/users/admin.py

32 lines
1.0 KiB
Python
Raw Normal View History

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
2021-01-15 12:03:28 +01:00
from .models import Account, Profile, Invite
2020-12-29 23:26:10 +01:00
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)
2020-12-31 15:56:44 +01:00
admin.site.register(Profile)
2021-01-15 12:03:28 +01:00
admin.site.register(Invite)