signals.py 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. from django.db.models.signals import post_migrate
  2. from django.dispatch import receiver
  3. from django.contrib.auth.models import Group
  4. from tickets.models import TicketList
  5. @receiver(post_migrate)
  6. def create_initial_ticket_lists(sender, **kwargs):
  7. if sender.name == 'tickets':
  8. # METASERVICE
  9. ## ADMIN
  10. TicketList.objects.get_or_create(pk=2101, name='Активация партнеров (NEG_REQUEST)', group=Group.objects.get(name='METASERVICE-ADMIN'))
  11. TicketList.objects.get_or_create(pk=2102, name='Права в сервисе (ACCESS_REQUEST)', group=Group.objects.get(name='METASERVICE-ADMIN'))
  12. TicketList.objects.get_or_create(pk=2103, name='Проверка документов (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-ADMIN'))
  13. ## SUPERVISOR
  14. TicketList.objects.get_or_create(pk=2201, name='Активность пользователей (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPERVISOR'))
  15. TicketList.objects.get_or_create(pk=2202, name='Оперативный доступ (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPERVISOR'))
  16. TicketList.objects.get_or_create(pk=2203, name='Оперативный доступ экстра (ACCESS_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPERVISOR'))
  17. TicketList.objects.get_or_create(pk=2204, name='Права сервиса (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPERVISOR'))
  18. TicketList.objects.get_or_create(pk=2205, name='Проверка документов (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPERVISOR'))
  19. ## SUPPORT
  20. TicketList.objects.get_or_create(pk=2301, name='Входящие обычные заявки (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPPORT'))
  21. TicketList.objects.get_or_create(pk=2302, name='Заявки на услуги сервиса (SERVICE_REQUEST)', group=Group.objects.get(name='METASERVICE-SUPPORT'))
  22. ## TECHSUPPORT
  23. TicketList.objects.get_or_create(pk=2401, name='Входящие технические заявки (ST_REQUEST)', group=Group.objects.get(name='METASERVICE-TECHSUPPORT'))
  24. # PARTNER
  25. ## ADMIN
  26. TicketList.objects.get_or_create(pk=3101, name='Документы исполнителей (ST_REQUEST)', group=Group.objects.get(name='PARTNER-ADMIN'))
  27. TicketList.objects.get_or_create(pk=3102, name='Документы ресурсов (ST_REQUEST)', group=Group.objects.get(name='PARTNER-ADMIN'))
  28. TicketList.objects.get_or_create(pk=3103, name='Права в партнерке (ACCESS_REQUEST)', group=Group.objects.get(name='PARTNER-ADMIN'))
  29. ## SUPERVISOR
  30. TicketList.objects.get_or_create(pk=3201, name='Активность внутри партнера (ST_REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
  31. TicketList.objects.get_or_create(pk=3202, name='Документы исполнителей (ST_REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
  32. TicketList.objects.get_or_create(pk=3203, name='Документы ресурсов (ST_REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
  33. TicketList.objects.get_or_create(pk=3204, name='Доступ внутри партнера (ST_REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
  34. TicketList.objects.get_or_create(pk=3205, name='Оперативный доступ (ST_REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
  35. TicketList.objects.get_or_create(pk=3206, name='Оперативный доступ экстра (ST_REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
  36. TicketList.objects.get_or_create(pk=3207, name='Ручное подтверждение заявок (ACCESS-REQUEST)', group=Group.objects.get(name='PARTNER-SUPERVISOR'))
  37. ## TECHSUPPORT
  38. TicketList.objects.get_or_create(pk=3401, name='Входящие технические заявки (ST_REQUEST)', group=Group.objects.get(name='PARTNER-TECHSUPPORT'))