in admin I have this code:
class ChildAdmin(admin.ModelAdmin):
def has_change_permission(self, request,obj=None):
# obj is the child and we fetch the project associated with the
child through
# the area.
if request.user.is_superuser:
return True
if obj == None:
return True
if
request.user.project_set.filter(name=obj.area.project.name).count():
return True
return False
def has_delete_permission(self, request, obj=None):
# Same as change permission
self.has_change_permission(request, obj=obj)
when I login as superuser and try to delete a child object I get a 403
forbidden error. Any clues?
--
regards
Kenneth Gonsalves
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment