Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to remove groups/user_permissions from user admin panel in django,how to edit fields shown on user admin panel

# admin.py
from django.contrib.auth.admin import UserAdmin

class CustomUserAdmin(UserAdmin):
    # ...Remove fields by overiding the fieldset value
    fieldsets = (
        (None, {'fields': ('username', 'password')}),
        (_('Personal info'), {'fields': ('first_name', 'last_name', 'email')}),
        (_('Permissions'), {
        'fields': ('is_active', 'is_staff', 'is_superuser', 'groups', 'user_permissions'),
    }),
        (_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)

admin.site.register(UserModel, CustomUserAdmin)
Comment

PREVIOUS NEXT
Code Example
Python :: pandas options 
Python :: append two dfs 
Python :: CMake Error at pybind11/tools/FindPythonLibsNew.cmake:131 (message): Python config failure: 
Python :: how to install pandas for aws sam local 
Python :: extract column of n array 
Python :: 2 plater die game in python 
Python :: python string name out of mail 
Python :: how to capitalize words in python 
Python :: rsa decryption 
Python :: how to skip error python 
Python :: how to check mix types in pandas column 
Python :: python sum certain postions of array 
Python :: pandas assign value to row based on condition 
Python :: python time.sleep 
Python :: python json change line 
Python :: django count all objects 
Python :: how to create image folder in numpy aray 
Python :: python add column to a matrix 
Python :: discord chatterbot python 
Python :: setting python2 in the path for npm install 
Python :: print 
Python :: Python Permutation without built-in function [itertools] for Lists 
Python :: extra import on django 
Python :: How to build a Least Recently Used (LRU) cache, in Python? 
Python :: how to input sentence in python 
Python :: python second element of every tuple in list 
Python :: code pandas from url 
Python :: python bug 
Python :: matplotlib yaxis off 
Python :: variable bound to a set python 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =