Answer the question
In order to leave comments, you need to log in
How to manage permissions in django?
For example, I need the permissions-filtering view functionality. There is no such thing in django.
How to implement it?
Examples. There is an author, he can view all published materials and all his own - incl. unpublished and non-public materials.
An unauthorized person can only view publicly posted content.
Admins can view absolutely any posts.
You can shove this logic into all views and tags. But it turns out code duplication. You can inherit from a view with get_context_data overridden. Already better. But still, you can be wrong. But again, duplication can be found in some template tag - for example, random topics in the sidebar.
The most beautiful option I see is to redefine the objects of the model. That's very beautiful. But without crutches, it will not be possible to get the user in the insides of the model.
How right?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question