Hi, I have been going through the permission documentation and i know i can assign users with permissions like this,
* request.user.user_permissions.add(1) * But having 100 or more permissions i find this method a bit weird. Is not there a way to say, * request.user.user_permissions.add('auth.delete_permission') or what i found in an other post, * * def get_permission_object(perm_label): from django.contrib.contenttypes.models import ContentType from django.contrib.auth.models import Permission app_label,perm_code_name = perm_label.split('.') content_type = ContentType.objects.get(app_label=app_label) perm = Permission.objects.get (content_type=content_type,codename=perm_code_name) return perm def add_perm_to_user(user,perm_label): user.user_permissions.add(get_permission_object(perm_label)) user.save() return user * Any suggestions? Thanks in advance! -- 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.