Jul 13
Extending different base template for ajax requests in Django
While there are different ways to specify what should be rendered what should server return when ajax request is performed, using yesno template filter can be simplest.
This can be especially useful in situations when using without javascript should fail gracefully or when working with existing views.
{% extends request.is_ajax|yesno:“base_ajax.html,base.html” %}
For this to work, django.core.context_processors.request should be installed in TEMPLATE_CONTEXT_PROCESSORS.
I am Bojan Mihelac and this blog is dedicated to share code, thoughts, tools and advices I came up with while working at 
blog comments powered by Disqus