Django authentication and social-sign on with django-allauth

How to customize the UserProfile admin page

Want more?

This lesson for enrolled students only. Join the course to unlock it!

You can see the code changes implemented in this lecture below.

If you have purchased the course in a different platform, you still have access to the code changes per lecture here on Teclado. The lecture video and lecture notes remain locked.
Join course for $15

Modified files

app/admin.py
--- 
+++ 
@@ -1,4 +1,5 @@
 from django.contrib import admin
+from django.contrib.auth.admin import UserAdmin
 from app.models import Article, UserProfile


@@ -11,5 +12,24 @@
     readonly_fields = ("word_count", "created_at", "updated_at")


+class CustomUserAdmin(UserAdmin):
+    fieldsets = (
+        (None, {"fields": ("email", "password")}),
+        ("Personal info", {"fields": ("first_name", "last_name")}),
+        ("Permissions", {"fields": ("is_active", "is_staff", "is_superuser", "groups", "user_permissions")}),
+        ("Important dates", {"fields": ("last_login", "date_joined")})
+    )
+    add_fieldsets = (
+        (None, {
+            "classes": ("wide",),
+            "fields": ("email", "password1", "password2")
+        }),
+    )
+    list_display = ("email", "is_staff", "is_active")
+    list_filter = ("is_staff", "is_active")
+    search_field = ("email",)
+    ordering = ("email",)
+
+
 admin.site.register(Article, ArticleAdmin)
-admin.site.register(UserProfile)+admin.site.register(UserProfile, CustomUserAdmin)