Answer the question
In order to leave comments, you need to log in
How to change path to template in Django view?
Tell me, is it possible to change the path to the template in the view based on some data?
For example, take a simple representation:
class CompanyDetail(DetailView):
model = Company
template_name = 'company/detail.html'
temp = Company.objects.get(pk=int(kwargs['pk']))
if temp.template_change:
template_name = 'company/detail2.html'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question