Answer the question
In order to leave comments, you need to log in
Why don't user permissions change (Django)?
Good day!
I can't understand why when changing user rights, he still has rights that were not granted to him.
class Account(AbstractBaseUser, PermissionsMixin):
email = models.EmailField('Email', max_length=150, unique=True)
name = models.CharField('Имя', max_length=255, blank=True, unique=True)
is_active = models.BooleanField('Активный?', default=False)
is_staff = models.BooleanField('Модератор?', default=False)
is_superuser = models.BooleanField('Админ?', default=False)
date_joined = models.DateTimeField('Дата создания', auto_now_add=True)
USERNAME_FIELD = 'name'
REQUIRED_FIELDS = ['email']
objects = UserManager()
def __str__(self):
return self.name
def get_full_name(self):
return self.name
def get_email(self):
return self.email
def has_perm(self, perm, obj=None):
return True
def has_module_perms(self, app_label):
return True
class Meta:
verbose_name = 'Пользователь'
verbose_name_plural = 'Пользователи'
class AccountAdmin(BaseUserAdmin):
add_form = UserAdminCreationForm
list_display = ['name', 'email', 'is_superuser']
list_filter = ['is_superuser', 'is_active', 'is_staff']
fieldsets = (
(None, {'fields': ('email', 'password')}),
('Информация', {'fields': ('name', )}),
('Разрешения', {'fields': ('is_active',
'is_superuser', 'is_staff', 'groups', 'user_permissions')}),
)
add_fieldsets = (
(None, {
'classes': ('wide',),
'fields': ('name', 'email', 'password1', 'password2', 'groups', 'user_permissions')}
),
)
search_fields = ['email']
ordering = ['email']
filter_horizontal = ('groups', 'user_permissions')
admin.site.register(Account, AccountAdmin)
Answer the question
In order to leave comments, you need to log in
It's better to have one big image, and then use magic to make images of any size from it
https://www.djangopackages.com/grids/g/thumbnails/
sorl-thumbnail.readthedocs.org/en/latest/examples... .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question