[Answered ]-Can I change the template search behavior of class based views?

2👍

✅

The easiest way is to specify template_name:

class MyListView(ListView):
    template_name = "transactions/batchfiles/list.html"

An alternative is to override get_template_names:

class MyListView(ListView):

    def get_template_names(self):
        return ["transactions/batchfiles/list.html"]

Note that it needs to return a list of possible template locations.

In this case there would only be one which is the desired location.

Leave a comment