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 .forms import UserCreationFormAdmin, UserChangeFormAdmin
- from .models import User
- @admin.register(User)
- class UserAdminPanel(UserAdmin):
- add_form = UserCreationFormAdmin
- form = UserChangeFormAdmin
- model = User
- list_display = ("email", "is_staff", "is_active",)
- list_filter = ("email", "is_staff", "is_active",)
- fieldsets = (
- (None, {"fields": ('first_name', 'last_name', 'username', 'email', 'display_name', 'date_of_birth', 'sex', "password")}),
- ("Permissions", {"fields": ("is_staff", "is_active", "is_superuser", "groups")}),
- )
- add_fieldsets = (
- (None, {
- "classes": ("wide",),
- "fields": (
- "username", "email", "password1", "password2", "is_staff",
- "is_active", "groups", "user_permissions"
- )}
- ),
- )
- search_fields = ("email",)
- ordering = ("email",)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement