Code


Version 1 (modified by robhudson, 4 years ago) (diff)

--

Agnostic HTML in Django

This page aims to document and discuss the output of either HTML4, HTML5, or XHTML from Django.

Background

Currently, Django biased to producing XHTML output in the various places that output HTML, such as comments, formtools, CSRF, forms.widgets, and various filters and HTML utilities that output "<br />" tags. If someone prefers an HTML4 doctype, this is a hassle with no easy answer.

Some tickets already open on this...

  • Ticket #6925: CSRF html output is not valid html (it is xhtml)
  • Ticket #7281: Add doctype tag to webdesign template tags
  • Ticket #7452: Settings for HTML4 or XHTML output

Some previous Django developer discussions...

General Agreement

The general agreement on the last Django developers discussion was:

  • A way to output HTML4, HTML5, or XHTML would be preferred, with XHTML being the default for backwards compatibility.
  • Having the choice at the template level is preferred to give designers the choice, and also allow different parts of a website to have different doctypes.
  • Avoid another setting, for the above reason and others.

3rd Party Solutions