aboutsummaryrefslogtreecommitdiffstats
path: root/modules/django_application/files/django_add_permission_to_group.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/django_application/files/django_add_permission_to_group.py')
-rw-r--r--modules/django_application/files/django_add_permission_to_group.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/django_application/files/django_add_permission_to_group.py b/modules/django_application/files/django_add_permission_to_group.py
new file mode 100644
index 00000000..c5edc31c
--- /dev/null
+++ b/modules/django_application/files/django_add_permission_to_group.py
@@ -0,0 +1,11 @@
+#!/usr/bin/python
+import sys
+group_name = sys.argv[1]
+permission = sys.argv[2]
+
+from django.contrib.auth.models import Group,Permission
+g = Group.objects.get(name=group_name)
+p = Permission.objects.get(codename=permission)
+
+g.permissions.add(p)
+g.save()