[autotest] add lightweight django setup for use in test_that
BUG=chromium:236471
TEST=new unit test, ensure that jobs can be added to django_lite db
Change-Id: I340934126f46e8158dd80b4727e6d54f856787dd
Reviewed-on: https://gerrit.chromium.org/gerrit/50210
Commit-Queue: Aviv Keshet <akeshet@chromium.org>
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
Tested-by: Aviv Keshet <akeshet@chromium.org>
diff --git a/frontend/afe/management.py b/frontend/afe/management.py
index 4f6066c..bdd5c6c 100644
--- a/frontend/afe/management.py
+++ b/frontend/afe/management.py
@@ -2,6 +2,7 @@
from django.db.models import signals
from django.contrib import auth
+from django.conf import settings
# In this file, it is critical that we import models *just like this*. In
# particular, we *cannot* do import common; from autotest_lib... import models.
# This is because when we pass the models module to signal.connect(), it
@@ -41,5 +42,5 @@
else:
print 'Group "%s" already exists' % BASIC_ADMIN
-
-signals.post_syncdb.connect(create_admin_group, sender=models)
+if settings.AUTOTEST_CREATE_ADMIN_GROUPS:
+ signals.post_syncdb.connect(create_admin_group, sender=models)