I find Django request.is_ajax a very useful way to add progressive enhancement through JS and still keep DRY in my views.
However, I want to use class-based views and rendering with a different template if request.is_ajax.
I don’t understand how I can redefine my template name "template_name" and make loading the template conditional in class-based views.
How can i do this?
source
share