Skip to content

Instantly share code, notes, and snippets.

View sadan's full-sized avatar
🎯
Focusing

Sadan A. sadan

🎯
Focusing
View GitHub Profile
@sadan
sadan / admin.py
Last active July 13, 2020 23:24
Extending AbstractUser to write a custom User model in Django.
"""
Your admin must also inherit from Django default `UserAdmin`, if you want to save
your time from all the hassle of creating some methods they have already created.
Now you can edit user admin the way you want by also getting advantage of all the
existing admin features.
"""
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin as OrigUserAdmin