Changes between Initial Version and Version 3 of Ticket #27386
- Timestamp:
- Oct 25, 2016, 5:36:19 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #27386
- Property Keywords callable is_readonly <p> added
- Property Triage Stage Unreviewed → Accepted
- Property Summary Callable field is wrapped inside <p>...</p> → Readonly callable field is unconditionally wrapped inside <p>...</p>, which might create invalid HTML
-
Ticket #27386 – Description
initial v3 1 (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>``.1 (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>`. 2 2 3 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.3 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. 4 4 5 5 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. 6 6 7 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.7 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.