ContentTypeViewMixin allow chaging URL kwargs

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-02-22 04:01:46 -04:00
parent 1cb3f9fe60
commit b975c75c2f

View File

@@ -29,10 +29,20 @@ __all__ = (
class ContentTypeViewMixin(object):
content_type_url_kw_args = {
'app_label': 'app_label',
'model': 'model'
}
def get_content_type(self):
return get_object_or_404(
klass=ContentType, app_label=self.kwargs['app_label'],
model=self.kwargs['model']
klass=ContentType,
app_label=self.kwargs[
self.content_type_url_kw_args['app_label']
],
model=self.kwargs[
self.content_type_url_kw_args['model']
]
)