docs: def page_template(template, key=PAGE_LABEL):
      """Return a view dynamically switching template if the request is Ajax.
  
      Decorate a view that takes a *template* and *extra_context* keyword
      arguments (like generic views).
      The template is switched to *page_template* if request is ajax and
      if *querystring_key* variable passed by the request equals to *key*.
      This allows multiple Ajax paginations in the same page.
      The name of the page template is given as *page_template* in the
      extra context.
      """
      def decorator(view):
          @wraps(view)
          def decorated(request, *args, **kwargs):
              # Trust the developer: he wrote ``context.update(extra_context)``
              # in his view.
              extra_context = kwargs.setdefault('extra_context', {})
              extra_context['page_template'] = template
              # Switch the template when the request is Ajax.
              querystring_key = request.GET.get(QS_KEY,
                  request.POST.get(QS_KEY, PAGE_LABEL))
              if request.is_ajax() and querystring_key == key:
                  kwargs[TEMPLATE_VARNAME] = template
              return view(request, *args, **kwargs)
          return decorated
  
      return decorator