Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Adding new fields in ModelAdmin with fieldsets to edit user, and add_fieldsets whan creating a new user

from django.contrib.auth.admin import UserAdmin

class CustomUserAdmin(UserAdmin):
    ...
    fieldsets = UserAdmin.fieldsets + (
        (None, {'fields': ('custom_field',)}),
    )
    add_fieldsets = UserAdmin.add_fieldsets + (
        (None, {'fields': ('custom_field',)}),
    )
Source by docs.djangoproject.com #
 
PREVIOUS NEXT
Tagged: #Adding #fields #ModelAdmin #fieldsets #edit #whan #creating #user
ADD COMMENT
Topic
Name
4+2 =