14 ms·
I'm not so sure about the 'including data in your template' section. It shows the regular way of adding context fields directly. I found greater success and cl
by evrimoztamur 3y ago
I'm not so sure about the 'including data in your template' section. It shows the regular way of adding context fields directly.
I found greater success and clarity with the @property and its cached brother @cached_property decorators. Using these two, you can access the view instance and its properties via just, e.g., 'view.foo' in the template.
@cached_property from what I understand is in fact originally a Django creation too (or at least its first popularising use https://github.com/python/cpython/issues/65344 https://github.com/python/cpython/issues/65344).