I used to have my pages in Django defined with functions like this:
def pdf(request):
return render(request, 'blog/pdf.html', {'title': 'PDF files'})
Where I was using a Title var for html page title. I started to use a TemplateView class for my pages and I'm not sure how to use the same title inside of something like this:
class About(LoginRequiredMixin, TemplateView):
template_name = 'blog/about.html'
Try this,
class About(LoginRequiredMixin, TemplateView):
template_name = 'blog/about.html'
def get_context_data(self, *args, **kwargs):
context = super(About, self).get_context_data(*args, **kwargs)
context['title'] = 'PDF files'
return context
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With