I use the following to determine the template on a pattern that matches the index page, in which I determine which template to load based on if it’s an AJAX request:
def home(request):
if request.is_ajax():
template = "ajax.html"
else:
template = "index.html"
entries = posts.objects.all()[:10]
return render_to_response(template, {'posts' : entries}, context_instance=RequestContext(request))
However, I don’t have anything regarding flatpages mentioned in my views.py, how can I do a similar request.is_ajax() check for the templates of flatpages?
Thanks!
Got it!
urls.py
views.py: