Commit b1fab877 authored by Serge S. Koval's avatar Serge S. Koval

Added _run_view method to BaseView, helpful if you want to customize your URL...

Added _run_view method to BaseView, helpful if you want to customize your URL to have slug or related ID
parent 7329f8aa
...@@ -65,7 +65,7 @@ def _wrap_view(f): ...@@ -65,7 +65,7 @@ def _wrap_view(f):
if abort is not None: if abort is not None:
return abort return abort
return f(self, *args, **kwargs) return self._run_view(f, *args, **kwargs)
inner._wrapped = True inner._wrapped = True
...@@ -325,6 +325,20 @@ class BaseView(with_metaclass(AdminViewMeta, BaseViewClass)): ...@@ -325,6 +325,20 @@ class BaseView(with_metaclass(AdminViewMeta, BaseViewClass)):
if not self.is_accessible(): if not self.is_accessible():
return self.inaccessible_callback(name, **kwargs) return self.inaccessible_callback(name, **kwargs)
def _run_view(self, fn, *args, **kwargs):
"""
This method will run actual view function.
While it is similar to _handle_view, can be used to change
arguments that are passed to the view.
:param fn:
View function
:param kwargs:
Arguments
"""
return fn(self, *args, **kwargs)
def inaccessible_callback(self, name, **kwargs): def inaccessible_callback(self, name, **kwargs):
""" """
Handle the response to inaccessible views. Handle the response to inaccessible views.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment