Tested and works great!

Thanks!

On 03/18/2013 04:14 PM, Julius Gawlas wrote:
with change to using south the previous was of
creation of admin in sync handler stopped working, here
we move it instead to post_migrate south signal

Signed-off-by: Julius Gawlas <[email protected]>
---
  frontend/afe/management.py |   13 ++++++-------
  1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/frontend/afe/management.py b/frontend/afe/management.py
index 94e53a2..42c3f59 100644
--- a/frontend/afe/management.py
+++ b/frontend/afe/management.py
@@ -1,19 +1,19 @@
-# use some undocumented Django tricks to execute custom logic after syncdb
-
-from django.db.models import signals
  from django.contrib import auth
  from autotest.frontend.afe import models
+from south.signals import post_migrate
BASIC_ADMIN = 'Basic admin' -def create_admin_group(app, created_models, verbosity, **kwargs):
+
+def create_admin_group(app, **kwargs):
      """\
      Create a basic admin group with permissions for managing basic autotest
      objects.
      """
+    print "Creatin/updating Basic admin group"
      admin_group, created = auth.models.Group.objects.get_or_create(
          name=BASIC_ADMIN)
-    admin_group.save() # must save before adding permissions
+    admin_group.save()  # must save before adding permissions
      PermissionModel = auth.models.Permission
      have_permissions = list(admin_group.permissions.all())
      for model_name in ('host', 'label', 'test', 'aclgroup', 'profiler',
@@ -34,5 +34,4 @@ def create_admin_group(app, created_models, verbosity, 
**kwargs):
      else:
          print 'Group "%s" already exists' % BASIC_ADMIN
-
-signals.post_syncdb.connect(create_admin_group, sender=models)
+post_migrate.connect(create_admin_group)

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to