#27386: Callable field is wrapped inside <p>...</p>
--------------------------------------+--------------------
Reporter: Jacob Rief | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Keywords: field
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
(Pseudo)-Fields in classes inheriting from
``django.contrib.admin.ModelsAdmin`` which are callables, must be listed
in ``readonly_fields``. This implies that in
``admin/includes/fieldset.html`` (line 17) and
``admin/edit_inline/tabular.html`` (line 55) the content of this field is
wrapped inside a paragraph ``<p>{{ field.contents }}</p>``.
However, a ``<p>...</p>`` is not suitable to accept every kind of HTML
element. Therefore when using a "callable" field, which renders it's
content in HTML, one might get a surprising result.
Since the author of a callable field may wrap it's content into whatever
(s)he likes, there should be a way to avoid these wrapping paragraphs.
My proposal is to check if ``field.contents`` is safe text, and if so then
leave it as-is, or otherwise wrap it into ``<p>..</p>`` as we do it right
now.
--
Ticket URL: <https://code.djangoproject.com/ticket/27386>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/048.6d99d72ae35e4dc1c24f63cca62694a3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.