The AdminReadonlyField has a method contents which creates the link. This method doesn’t know anything about the user or his/her permissions. And that’s ok.
What I’ve tried:
Give AdminReadonlyField attributes like view-permission etc to determine in the template what I want to show - doesn’t work because all the magic is in the contents method
Pass the user object to the contains method from the template
27 different approaches with filters and template tags
Does anybody has an idea on how I can solve this? I’ve tried for hours now to solve this but I failed
Hi @tom, I talked with @sarahboyce about this bug / bad UX and she mentioned you as a somebody I could ask for some input on admin topics.
I tried hard to find a solution but I’m missing something conceptually since withouth a large refactoring, I’m just not able to bring together the permission check and the link creation.
Thx!
Ronny
PS: Saw your talk in Vigo about improving accessability in the admin. This might to in the same direction, more or less.
Thx @sarahboyce for the suggestion! I had a look and the problem is that I don’t have the related model in the template. I do have the instance of the edit pages model but not the related one. Thus, I can’t do the check their. If I had it and could put together the permission check somehow, striptag would work!