I need to add to the output of the TemplateView html {%extends some_base.html%} in the views.py. I can't work with html directly, cause template_name will be always different and i don't want to add {%extends..%} to each template.html file. i want to do something like this:
class PageView(TemplateView):
def get_context_data(self, **kwargs):
object = PageModel.objects.get(view_base__slug=kwargs.get('slug'))
self.template_name = object.template_name
self.base='base.html'
from django.template.loader import render_to_string
#just example, it's not working
rendered = render_to_string(self.template_name)
rendered= '{% extends' + self.base + '%} '+ rendered
###
return locals()
But it does not work. Even more - i want to save all variables, which are being passed to the template.