Add support for proxy model permission inheritance

Proxy models now get the permission inheritance from their base model.

Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-11-09 02:04:54 -04:00
parent 49017cb3d9
commit 39fe18c332
4 changed files with 123 additions and 18 deletions
+4
View File
@@ -80,6 +80,10 @@ class ModelPermission(object):
@classmethod
def get_inheritance(cls, model):
# Proxy models get the inheritance from their base model
if model._meta.proxy:
model = model._meta.proxy_for_model
return cls._inheritances[model]
@classmethod