Hello,

I would like to install an auth_group with my application and am
considering using the following code in app/management/__init__.py.
Is this an acceptable solution?  Is there a better way to do this?

Thanks,
Mark

from django.db.models import signals
try:
    from django.contrib.auth.models import Permission, Group
    skip = False
except:
    print """Please add django.contrib.auth to your INSTALLED_APPS in
setting.py.
    If this is your first syncdb please re-run so security groups get
added for my_app."""
    skip = True

def create_groups(sender, **kwargs):
    if skip:
        return
    try:
        Group.objects.get(name='workorder_admin')
    except:
        wo_admin_g = Group(name='workorder_admin').save()

signals.post_syncdb.connect(create_groups)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to