/[adm]/puppet/modules/django_application/files/django_add_permission_to_group.py
ViewVC logotype

Contents of /puppet/modules/django_application/files/django_add_permission_to_group.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1196 - (show annotations) (download) (as text)
Thu Feb 24 18:52:53 2011 UTC (12 years, 9 months ago) by misc
File MIME type: text/x-python
File size: 254 byte(s)
- add 2 class to add group to a django application, as well as
  permission ( used for tx )
1 #!/usr/bin/python
2 import sys
3 group_name = sys.argv[1]
4 permission = sys.argv[2]
5
6 from django.contrib.auth.models import Group,Permission
7 g = Group.objects.get(name=group_name)
8 p = Permission.objects.get(codename=permission)
9
10 g.permissions.add(p)
11 g.save()

  ViewVC Help
Powered by ViewVC 1.1.28