Opened 6 years ago

Closed 6 years ago

#19363 closed Uncategorized (invalid)

Admin pages no longer validate as XHTML

Reported by: Chris Wilson Owned by: nobody
Component: Uncategorized Version: 1.5-alpha-1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The Admin pages used to validate as XHTML, and it seems that that was intended, as the validation failure pointed out in #544 was fixed.

However it is now broken again, because the doctype in the header has changed from:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

to just:

<!DOCTYPE html>

which does not declare any entities, and therefore validation fails when it encounters &rsaquo; entities in the breadcrumbs in admin/base.html:

<div class="breadcrumbs">
<a href="/admin/">Home</a>
&rsaquo; <a href="/admin/users/">Users</a>
&rsaquo; <a href="/admin/users/ischooluser/">ISchool Users</a>
&rsaquo; john

I'd be OK with a more relaxed doctype, but if that's the intention, please can you at least wrap it in a block so that we can override it without copying and pasting the whole of admin/base.html just to change one line?

Change History (1)

comment:1 Changed 6 years ago by Aymeric Augustin

Resolution: invalid
Status: newclosed

Indeed, best practices for web development have evolved since #544 was fixed 7 years ago, and the admin templates were changed to HTML5 in Django 1.4 (not in 1.5). They aren't intended to validate as XHTML any longer.

Since they used to be valid XHTML, they still mostly are, but that will be less and less true as HTML5 code that isn't valid XHTML, such as single unclosed tags, is introduced by new commits. Allowing to override just the doctype won't help in the long term. It would set false expectations.

To sum up, XHTML validity isn't guaranteed by Django any longer. If you need it, you should maintain your own templates.

Note: See TracTickets for help on using tickets.
Back to Top