Slide 38
Slide 38 text
14
Гибрид class-based и обычных view
def method(self, *args, **kwargs):
def wrapper(_method):
@wraps(_method)
def wrapped(view_obj, request: HttpRequest, *m_args, **m_kwargs):
ctx = dict(
# LOTS OF OTHER ARGS
request=request,
)
return self._view(view_obj, _method, ctx, *m_args, **m_kwargs)
return wrapped
return wrapper