= 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 "
" 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... * Mar 2008: [http://groups.google.com/group/django-developers/browse_thread/thread/5f3694b8a19fb9a1 Form rendering with filters] * Sept 2008: [http://groups.google.com/group/django-developers/browse_thread/thread/f04aed2bc60274f0 {% doctype %} and {% field %} tag for outputting form widgets as HTML or XHTML] * Sept 2009: [http://groups.google.com/group/django-developers/browse_thread/thread/bbf75f0eeaf9fa64/1b7eacb9aee74232? Proposal: Better HTML4 Support] == 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 == * django-html [http://github.com/simonw/django-html http://github.com/simonw/django-html]