123456789101112131415161718192021222324 |
- from django.contrib import admin
- from django.contrib.auth import get_user_model
- from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
- from django.contrib.auth.models import User
-
- from .models import Post, CustomUser
-
-
-
- class CustomUserInline(admin.StackedInline):
- model = CustomUser
- can_delete = False
- verbose_name_plural = 'customUsers'
-
- # Define a new User admin
- class UserAdmin(BaseUserAdmin):
- inlines = (CustomUserInline, )
-
- # Re-register UserAdmin
- admin.site.unregister(User)
- admin.site.register(User, UserAdmin)
-
- admin.site.register(Post)
|