docs: def render_flatpage(request, f):
      """
      Internal interface to the flat page view.
      """
      # If registration is required for accessing this page, and the user isn't
      # logged in, redirect to the login page.
      if f.registration_required and not request.user.is_authenticated():
          from django.contrib.auth.views import redirect_to_login
          return redirect_to_login(request.path)
      if f.template_name:
          t = loader.select_template((f.template_name, DEFAULT_TEMPLATE))
      else:
          t = loader.get_template(DEFAULT_TEMPLATE)
  
      # To avoid having to always use the "|safe" filter in flatpage templates,
      # mark the title and content as already safe (since they are raw HTML
      # content in the first place).
      f.title = mark_safe(f.title)
      f.content = mark_safe(f.content)
  
      response = HttpResponse(t.render({
          'flatpage': f
      }, request))
  
      try:
          from django.core.xheaders import populate_xheaders
          populate_xheaders(request, response, FlatPage_i18n, f.id)
      except ImportError:
          pass
      return response