signals.py 922 B

1234567891011121314151617181920212223
  1. from django.contrib.auth.models import Group
  2. from django.dispatch import receiver
  3. from django.db.models.signals import post_migrate
  4. # Создание групп
  5. @receiver(post_migrate)
  6. def create_groups(sender, **kwargs):
  7. Group.objects.get_or_create(pk=21, name='METASERVICE-ADMIN')
  8. Group.objects.get_or_create(pk=22, name='METASERVICE-SUPERVISOR')
  9. Group.objects.get_or_create(pk=23, name='METASERVICE-SUPPORT')
  10. Group.objects.get_or_create(pk=24, name='METASERVICE-TECHSUPPORT')
  11. Group.objects.get_or_create(pk=31, name='PARTNER-ADMIN')
  12. Group.objects.get_or_create(pk=32, name='PARTNER-SUPERVISOR')
  13. Group.objects.get_or_create(pk=33, name='PARTNER-SUPPORT')
  14. Group.objects.get_or_create(pk=34, name='PARTNER-TECHSUPPORT')
  15. Group.objects.get_or_create(pk=41, name='PROVIDER')
  16. Group.objects.get_or_create(pk=51, name='CLIENT')
  17. Group.objects.get_or_create(pk=61, name='GUEST')