{{{
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. › 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.
* 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>
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>
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>
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>
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>
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>
* 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>
* status: closed => new
* resolution: duplicate =>
--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:8>
* 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>
* owner: nobody => Anton Samarchyan
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/23908#comment:10>
* 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>
* 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>
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>
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>
* 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>