[Answer]-Django template inheritance: repetitive views

1👍

You don’t say how you’re determining which template is to be rendered. But presuming it’s based on a parameter from the URL, you can define the get_template_namesmethod in your view.

That method can access self.kwargs and self.request etc and then return a list containing the name of the template to use. (Note that it does have to be a list, even if the list only contains one item.)

Leave a comment