If you use class-based views, you can simply specify the current context as a variable in the context:
class MainView(TemplateView): template_name = 'base.html' def get_context_data(self, **kwargs): ctx = super(MainView, self).get_context_data(**kwargs) ctx['ctx'] = ctx return ctx
How can you access the context with {{ctx}}
source share