[Django] #23908: XHTML breaks admin site

20 views
Skip to first unread message

Django

unread,
Nov 24, 2014, 6:59:24 PM11/24/14
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------+--------------------
Reporter: brian | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
By declaring:

{{{
DEFAULT_CONTENT_TYPE = "application/xhtml+xml"
}}}

The admin site no longer renders correctly.

I think the problem is that we haven't declared the XML namespace
correctly, e.g.:

{{{
<html xmlns="http://www.w3.org/1999/xhtml">
}}}

There are also some other trivial problems, e.g. &rsaquo; no longer works
(used in breadcrumbs).

Thanks

--
Ticket URL: <https://code.djangoproject.com/ticket/23908>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 24, 2014, 7:30:23 PM11/24/14
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------+--------------------------------------
Reporter: brian | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.7
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by timgraham):

* status: new => closed
* needs_better_patch: => 0
* resolution: => duplicate
* needs_tests: => 0
* needs_docs: => 0


Comment:

The admin isn't designed to work as XHTML, see #19363.

--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:1>

Django

unread,
Nov 24, 2014, 9:33:36 PM11/24/14
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------+--------------------------------------
Reporter: brian | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.7
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by brian):

My understanding is that XHTML is still a current standard, even with
HTML5.

See http://www.w3.org/TR/html5/, note the title "A vocabulary and
associated APIs for HTML and XHTML". This was published last month.

As such, the response in #19363 implying that HTML5 replaces XHTML is
nonsense.

Also it possible to add something like the following in the <head> section
to force use of HTML, even when XHTML is the default:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

I feel that something like Django should really keep up with the modern
standards.

--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:2>

Django

unread,
Nov 24, 2014, 10:40:08 PM11/24/14
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------+--------------------------------------
Reporter: brian | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.7
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by jarshwah):

I didn't get the implication that "HTML5 replaces XHTML" from the linked
ticket. Just that Django has chosen to support HTML5 rather than XHTML
[N].

From your link: http://www.w3.org/TR/html5/introduction.html#html-vs-xhtml

> The first such concrete syntax is the HTML syntax. This is the format
suggested for most authors. ... This specification defines version 5.0 of
the HTML syntax, known as "HTML 5".
> The second concrete syntax is the XHTML syntax, which is an application
of XML. ... This specification defines version 5.0 of the XHTML syntax,
known as "XHTML 5".
> The DOM, the HTML syntax, and the XHTML syntax cannot all represent the
same content.

My understanding is that authors should *choose* which to support. The
authors of the Admin have chosen HTML 5. You are free to choose XHTML 5
for your own templates.

HTML 5 *is* a modern standard. There is no requirement (demonstrated) to
support multiple, competing standards though.

Is there a particular reason that you feel Django should support XHTML 5
in the admin?

--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:3>

Django

unread,
Nov 24, 2014, 10:50:26 PM11/24/14
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------+--------------------------------------
Reporter: brian | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.7
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by brian):

Django Admin doesn't need to support XHTML, however it should be possible
to use it with applications that do use XHTML.

As it is, it is not possible for applications to support both XHTML 5 and
use Django Admin, because the DEFAULT_CONTENT_TYPE setting is global
across all of Django. So you either have to use HTML or turn off Django
Admin.

Not to mention XHTML being superior because parsing errors are flagged
immediately rather then being ignored.

The meta setting I previously gave would allow Django admin to work as
HTML even if the DEFAULT_CONTENT_TYPE setting has been changed, although
it could perhaps be argued this is a bit of a kludge, as it overrides the
HTTP headers.

--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:4>

Django

unread,
Nov 24, 2014, 10:57:55 PM11/24/14
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------+--------------------------------------
Reporter: brian | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.7
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by jarshwah):

In that case, would it maybe make sense to manually specify the
mime/content type of all the admins HttpResponse objects? Would that avoid
the problem you're seeing?

--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:5>

Django

unread,
Nov 24, 2014, 11:12:41 PM11/24/14
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------+--------------------------------------
Reporter: brian | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.7
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by brian):

Yes, I believe that would be satisfactory.

I just looked at the code to try and get a vague idea of how this could be
done, looks like TemplateResponse instances would need changing in
django/contrib/admin/options.py - if my quick glance is sufficient.

--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:6>

Django

unread,
Nov 25, 2014, 12:40:54 AM11/25/14
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------+-------------------------------------
Reporter: brian | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.7
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+-------------------------------------
Changes (by jarshwah):

* stage: Unreviewed => Accepted


Comment:

Reopening on the basis that the admin site breaks when the following
option is set: DEFAULT_CONTENT_TYPE = "application/xhtml+xml"

Since admin supports HTML 5 only - it should take measures to ensure the
appropriate headers are sent when the default is not applicable.

--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:7>

Django

unread,
Nov 25, 2014, 12:41:24 AM11/25/14
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------+------------------------------------

Reporter: brian | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.7
Severity: Normal | Resolution:

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by jarshwah):

* status: closed => new
* resolution: duplicate =>


--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:8>

Django

unread,
Jan 1, 2015, 11:12:17 PM1/1/15
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------+------------------------------------

Reporter: brian | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by collinanderson):

* cc: cmawebsite@… (added)


Comment:

I'm personally not a huge fan of having every admin view manually specify
the content type. Some crazy alternatives:
1. Recommend against DEFAULT_CONTENT_TYPE as it's a magic global setting.
The admin might be one example of a bigger issue.
2. Make the admin XHTML compatible despite what we said earlier.
https://github.com/django/django/pull/3824

--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:9>

Django

unread,
Jan 6, 2017, 1:54:37 PM1/6/17
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------------+-------------------------------------
Reporter: Brian May | Owner: Anton
| Samarchyan
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.7

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Anton Samarchyan):

* owner: nobody => Anton Samarchyan
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:10>

Django

unread,
Jan 6, 2017, 3:08:25 PM1/6/17
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------------+-------------------------------------
Reporter: Brian May | Owner: Anton
| Samarchyan
Type: Bug | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Anton Samarchyan):

* has_patch: 0 => 1
* version: 1.7 => master


Comment:

Added [https://github.com/django/django/pull/7807 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:11>

Django

unread,
Jan 10, 2017, 1:16:02 PM1/10/17
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------------+-------------------------------------
Reporter: Brian May | Owner: Anton
| Samarchyan
Type: Bug | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


Comment:

I wrote to [https://groups.google.com/d/topic/django-
developers/EdwwxxqcKVU/discussion django-developers] to try to get a
consensus of whether or not we should make that change.

--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:12>

Django

unread,
Jan 28, 2017, 1:15:18 PM1/28/17
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------------+-------------------------------------
Reporter: Brian May | Owner: Anton
| Samarchyan
Type: Bug | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

The consensus on the mailing list is toward deprecating the
`DEFAULT_CONTENT_TYPE` setting. Do you have a use case that argues against
that which you could add to the discussion, Brian?

--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:13>

Django

unread,
Feb 12, 2017, 2:29:14 AM2/12/17
to django-...@googlegroups.com
#23908: XHTML breaks admin site
-------------------------------------+-------------------------------------
Reporter: Brian May | Owner: Anton
| Samarchyan
Type: Bug | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Brian May):

I sent an update to the mailing list, which is awaiting moderation.

--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:14>

Django

unread,
Feb 13, 2017, 7:27:37 AM2/13/17
to django-...@googlegroups.com
#23908: settings.DEFAULT_CONTENT_TYPE = "application/xhtml+xml" breaks admin site

-------------------------------------+-------------------------------------
Reporter: Brian May | Owner: Anton
| Samarchyan
Type: Bug | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: assigned => closed
* resolution: => wontfix


Comment:

Thanks for replying. #27829 will deprecate
`settings.DEFAULT_CONTENT_TYPE`.

--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:15>

Reply all
Reply to author
Forward
0 new messages