apps: only execute post_migrate signal if the Operation model exists

This commit is contained in:
Benjamin Dauvergne 2017-07-17 18:45:54 +02:00
parent 3c94ec8352
commit 33b2c69554
1 changed files with 6 additions and 1 deletions

View File

@ -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)