id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 27386 Readonly callable field is unconditionally wrapped inside
...
, which might create invalid HTML Jacob Rief nobody "(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 `{{ field.contents }}
`. However, a `...
` 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 `..
` as we do it right now." Cleanup/optimization closed contrib.admin dev Normal fixed callable field is_readonlyAccepted 1 0 0 1 0 0