Objects with permissions assigned by django-guardian not visible in admin
- by jul
I'm using django-guardian in order to manage per object permission.
For a given user I give permission all permission on 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 make TaskAdmin inherit from GuardedModelAdmin instead of admin.ModelAdmin
Now when I connect to my site with joe, on the admin I get:
You don't have permission to edit anything
Am I not supposed to be able to edit the object mytask?
Do I have to set some permissions using the built-in model-based permission system?
Am I missing anything?
Thank you