Utils and Decorators

Utils

jsonit.utils.ajax_aware_render(request, template_list, context=None, **kwargs)

Render a template, using a different one automatically for AJAX requests.

Parameters:
  • template_list – Either a template name or a list of template names.
  • context – Optional extra context to pass to the template.

For AJAX requests, the template list is altered to look for alternate templates first and the is_ajax context variable is set to True.

For example, if template_list was set to ['custom/login.html', 'login.html'], then an AJAX request will change this to:

['custom/login.ajax.html', 'login.ajax.html',
 'custom/login.html', 'login.html']

Decorators

Project Versions

Table Of Contents

Previous topic

Views

This Page