Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.contrib import admin
- from django.contrib.auth.admin import UserAdmin
- from .models import CustomUser
- class CustomUserAdmin(UserAdmin):
- list_display = ("full_name", "email", "location", "last_login", "is_admin", "is_staff")
- search_fields = ("full_name", "email", "location")
- readonly_fields = ("password", "date_joined", "last_login")
- ordering = ("full_name",)
- filter_horizontal = ()
- list_filter = ()
- fieldsets = (("Login",
- {
- "fields": ("email",)
- }),
- ("Personal details",
- {
- "classes": ("wide",),
- "fields": ("profile_pic", "full_name", "location", "bio", ("linkedin", "facebook", "twitter", "instagram"))
- }),
- ("Social",
- {
- "classes": ("wide",),
- "fields": (("follows",),)
- })
- )
- add_fieldsets = (
- (None, ({"fields": ("email", "full_name", "password1", "password2")})),
- )
- admin.site.register(CustomUser, CustomUserAdmin)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement