apps: only execute post_migrate signal if the Operation model exists
This commit is contained in:
parent
3c94ec8352
commit
33b2c69554
|
@ -18,15 +18,20 @@
|
|||
|
||||
import django.apps
|
||||
|
||||
from django.db import router, DEFAULT_DB_ALIAS
|
||||
|
||||
|
||||
class AppConfig(django.apps.AppConfig):
|
||||
name = 'authentic2_cut'
|
||||
|
||||
def post_migrate(self, **kwargs):
|
||||
def post_migrate(self, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs):
|
||||
# create custom operations
|
||||
from django_rbac.models import Operation
|
||||
from django_rbac.utils import get_operation
|
||||
|
||||
if not router.allow_migrate(using, Operation):
|
||||
return
|
||||
|
||||
FC_MANAGE_OP = Operation(name=u'Gérer France Connect',
|
||||
slug='fc_manage')
|
||||
get_operation(FC_MANAGE_OP)
|
||||
|
|
Loading…
Reference in New Issue