I am an admitted rookie in Django and have run into an issue I hope someone can help me with. I have a webpage with an accordion control and I iterate through a bunch or disparate data to populate the control, but I want to not list some data based on user permissions. I have been able to not produce blinds if I call user.is_staff, but can’t figure out how to do that by using a user’s permissions. I’ve seen sample code where I can do quite a bit more work than just adding an if statement around the iteration of the blinds.
Some users should be able to see all the blinds and some not. I just can’t figure out how to do that.
I wouldn’t try to do that in the template. I’d write my view to filter those objects before trying to render them. (We try to avoid injecting any “data-filter” type logic in our templates. It tends to make diagnosing issues a whole lot easier.)
Thank you. I will give that a shot!