Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using valid HTML 4.01 Strict with Django

I've found a similar question here, but I'm looking for more general solutions.

As it is now, when Django generates anykind of HTML for you (this mainly happens when generating forms), it uses self-closing tags by default i.e. <br /> instead of <br>. <br /> is valid XHTML and I think HTML5 also, but it's not valid HTML4.

Is there any clean way to override this? Or is it better to write django sites in XHTML or HTML5 instead?

like image 892
Monika Sulik Avatar asked Nov 18 '25 00:11

Monika Sulik


1 Answers

There was a whole series of discussions on this when development for 1.2 kicked off, with a range of solutions proposed, but no general way forward was agreed.

But see Simon Willison's Django-HTML project for one possible solution.

like image 180
Daniel Roseman Avatar answered Nov 20 '25 15:11

Daniel Roseman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!