| 1 | = Agnostic HTML in Django = |
| 2 | |
| 3 | This page aims to document and discuss the output of either HTML4, HTML5, or XHTML from Django. |
| 4 | |
| 5 | == Background == |
| 6 | |
| 7 | 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. |
| 8 | |
| 9 | Some tickets already open on this... |
| 10 | |
| 11 | * Ticket #6925: CSRF html output is not valid html (it is xhtml) |
| 12 | * Ticket #7281: Add doctype tag to webdesign template tags |
| 13 | * Ticket #7452: Settings for HTML4 or XHTML output |
| 14 | |
| 15 | Some previous Django developer discussions... |
| 16 | |
| 17 | * Mar 2008: [http://groups.google.com/group/django-developers/browse_thread/thread/5f3694b8a19fb9a1 Form rendering with filters] |
| 18 | * 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] |
| 19 | * Sept 2009: [http://groups.google.com/group/django-developers/browse_thread/thread/bbf75f0eeaf9fa64/1b7eacb9aee74232? Proposal: Better HTML4 Support] |
| 20 | |
| 21 | == General Agreement == |
| 22 | |
| 23 | The general agreement on the last Django developers discussion was: |
| 24 | |
| 25 | * A way to output HTML4, HTML5, or XHTML would be preferred, with XHTML being the default for backwards compatibility. |
| 26 | * 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. |
| 27 | * Avoid another setting, for the above reason and others. |
| 28 | |
| 29 | == 3rd Party Solutions == |
| 30 | |
| 31 | * django-html [http://github.com/simonw/django-html http://github.com/simonw/django-html] |