2 Commits 08ddad8f87 ... 66ea810d43

Author SHA1 Message Date
  TonyKurts 66ea810d43 Added possibility of automatic generation of test users during project installation and upgrade using *bin/install.sh* 1 week ago
  TonyKurts 08ddad8f87 Added possibility of automatic generation of test users during project installation and upgrade using *bin/install.sh* 1 week ago
1 changed files with 6 additions and 5 deletions
  1. 6 5
      sharix_admin/signals.py

+ 6 - 5
sharix_admin/signals.py

@@ -126,9 +126,10 @@ def create_initial_ticket_lists(sender, **kwargs):
         TicketList.objects.get_or_create(pk=3401, name='Входящие технические заявки (ST_REQUEST)', group=Group.objects.get(name='PARTNER-TECHSUPPORT'))
 
 
-# Откючаем тестовых пользователей, если DEBUG=False и наоброт
-test_group = Group.objects.get(name="TEST")
-users_in_test_group = User.objects.filter(groups=test_group)
+# Откючаем тестовых пользователей (если такие есть), если DEBUG=False и наоброт
+if Group.objects.filter(name="TEST").exists():
+    test_group = Group.objects.get(name="TEST")
+    users_in_test_group = User.objects.filter(groups=test_group)
 
-if users_in_test_group:
-    users_in_test_group.update(is_active=settings.DEBUG)
+    if users_in_test_group:
+        users_in_test_group.update(is_active=settings.DEBUG)