#22241 closed Bug (fixed)
Extra line break tags in contrib/admin/templates/admin/includes/fieldset.html break display of computed fields
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.admin | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | atodorov@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This is a reference to #19226 which is not properly fixed.
See:
https://code.djangoproject.com/ticket/19226#comment:14
<quote>
Hi guys,
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.
</quote>
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.
Attachments (4)
Change History (7)
by , 11 years ago
Attachment: | bugtest.tar.gz added |
---|
comment:1 by , 11 years ago
Component: | Template system → contrib.admin |
---|---|
Has patch: | set |
Triage Stage: | Unreviewed → Accepted |
Thanks for the code and screenshots, this is helpful.
I'll upload a patch for this issue. Please review/test.
comment:2 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Small project to reproduce the issue