customized form added to the admin interface for the user
This commit is contained in:
parent
6743153be0
commit
f8af9ee5df
2 changed files with 26 additions and 1 deletions
|
|
@ -1,4 +1,22 @@
|
|||
from django.contrib import admin
|
||||
from .models import CustomUser
|
||||
from .forms import CustomUserCreationForm
|
||||
from django.contrib.auth.admin import UserAdmin
|
||||
|
||||
admin.site.register(CustomUser)
|
||||
@admin.register(CustomUser)
|
||||
class CustomUserAdmin(admin.ModelAdmin):
|
||||
add_form = CustomUserCreationForm
|
||||
|
||||
fieldsets = (
|
||||
*UserAdmin.fieldsets,
|
||||
(
|
||||
'Individual data',
|
||||
{
|
||||
'fields': (
|
||||
'custom',
|
||||
'phone',
|
||||
'address',
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
|
|
|
|||
7
backend/videoflix/users/forms.py
Normal file
7
backend/videoflix/users/forms.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
from django.contrib.auth.forms import UserCreationForm
|
||||
from .models import CustomUser
|
||||
|
||||
class CustomUserCreationForm(UserCreationForm):
|
||||
class Meta:
|
||||
model = CustomUser
|
||||
fields = '__all__'
|
||||
Loading…
Reference in a new issue