Extra line break tags in contrib/admin/templates/admin/includes/fieldset.html break display of computed fields
|Reported by:||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
This is a reference to #19226 which is not properly fixed.
this fix is breaking up display for me. I'm using computed read-only fields which display rich HTML into the model change form as a way to augment the administration experience which works really well for me.
Adding multiple line break tags breaks my display (this only happens because the templates used to render the fields have new lines in them). Now I have to go all-over my code and strip new lines before returning the field value.
It would be nice if the linebreaks filter skipped \n, <br/> replacement on safe strings.
Attached is code to reproduce. Run it on Django 1.4.X and then on 1.5.X or 1.6.X to see the difference.
In the add/change form for Advisory objects there are several divs which should appear on the same line but with the added line breaks they get messed up.
Workaround is to remove all newlines before rendering this field value.
Initially the bug was reported against text area type of fields so either fix it only for them or allow linebreaksbr filter to skip safe strings.
Change History (7)
comment:1 Changed 3 years ago by
|Component:||Template system → contrib.admin|
|Triage Stage:||Unreviewed → Accepted|