Hi!
-- I am having a challenge . My aim is to be able to assign some group permissions when the group is created. In admin.py I have a custom GroupAdmin class on which I have the function save customized but the challenge is everything else get saved and reflected on admin page including user permissions(if i set permissions to the user direct) but the group permissions seems to be saved but when I go to admin page they are not assigned.
Can you share you experience !
permits = Permission.objects.filter(content_type__app_label='myapp')
####Saved but not updated on Admin page
obj.permissions=permits
obj.save()
#####Works Perfect and changes seen on admin page
user = User.objects.create_user('username12', '', 'password')
user.groups.add(obj)
user.user_permissions=perms
user.is_staff=True
user.save()
obj is an object of Group.
Regards
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f862d504-99fa-4a1f-a6ea-523ba4cca67a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment