Answer the question
In order to leave comments, you need to log in
Django how to disable automatic creation of permissions?
The question is:
How can I disable automatic creation of permissions (permissions) in the auth_permission table when running the migrate command? In each model, I myself specify my rights and disable the default rights in the Meta class of the model:
class RhFactor(models.Model):
name = models.TextField()
code = models.TextField()
class Meta:
db_table = 'rh_factors'
managed = True
permissions = (
("add_rh", "Добавление резус-фактора"),
("change_rh", "Изменение резус-фактора"),
("delete_rh", "Удаление резус-фактора"),
)
default_permissions = ()
Answer the question
In order to leave comments, you need to log in
Instead of 'django.contrib.auth' include in `INSTALLED_APPS` your own AppConfig for auth package
https://github.com/django/django/blob/master/djang...
https://docs.djangoproject.com/en/ 1.10/ref/applic...
INSTALLED_APPS = [
...
'myapp.apps.AuthConfig'
...
]
# myapp/apps.py
from django.apps import AppConfig
from django.core import checks
from django.contrib.auth.checks import check_models_permissions, check_user_model
class AuthConfig(AppConfig):
name = 'django.contrib.auth'
verbose_name = _("Authentication and Authorization")
def ready(self):
checks.register(check_user_model, checks.Tags.models)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question