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

0

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',)}),
    )
Posted by: Guest on September-24-2021

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

Python Answers by Framework

Browse Popular Code Answers by Language