I use django-guardian to control permission for each object.
For this user, I allow permission for one object:
joe = User.objects.get(username="joe") mytask = Task.objects.get(pk=1) assign('add_task', joe, mytask) assign('change_task', joe, mytask) assign('delete_task', joe, mytask)
and I get, as expected:
In [57]: joe.has_perm("add_task", mytask) Out[57]: True In [58]: joe.has_perm("change_task", mytask) Out[58]: True In [59]: joe.has_perm("delete_task", mytask) Out[59]: True
In admin.py, I also inherit TaskAdmin from GuardedModelAdmin
instead of admin.ModelAdmin
Now, when I connect to my site using joe, from the administrator I get:
You don't have permission to edit anything
Maybe I can not edit mytask object?
Do I need to set some permissions with the built-in model-based permission system?
Did I miss something?
EDIT
I tried adding the user_can_access_owned_objects_only
parameter, which should deal with my problem, but I still cannot see anything in my admin ...
class TaskAdmin(GuardedModelAdmin): user_can_access_owned_objects_only = True pass admin.site.register(Task, TaskAdmin)
thanks