#5631 closed (fixed)
newforms-admin: 'classes': 'collapse' does not work (in one case)
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | |
Severity: | Keywords: | newforms-admin collapse admin | |
Cc: | aloysius.prayitno@…, andy@…, flori@…, email@…, djanger@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Attachments (1)
Change History (11)
comment:1 by , 17 years ago
Cc: | added |
---|
comment:2 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:4 by , 16 years ago
Cc: | added |
---|---|
Resolution: | invalid |
Status: | closed → reopened |
Version: | newforms-admin |
This is actually still a problem post newforms-admin merge. What appears to happening is that:
- CollapsedFieldsets.js in admin-media checks to make sure that no fieldset with a class of 'errors' is collapsed.
- For some reason if you group any fields into a single line then that fieldset get's given a class of 'error'
I suspect #2 might be a workaround for some other problem if it's not an out and out mistake.
So:
('Heading', { 'classes': ('collapse',), 'fields': ('field1','field2','field3')})
collapses successfully but...
('Heading', { 'classes': ('collapse',), 'fields': (('field1','field2'),'field3')})
doesn't.
Incidentally - setting the fieldset name to None also breaks 'collapse'.
comment:5 by , 16 years ago
Has patch: | set |
---|---|
milestone: | → 1.0 |
Summary: | newforms-admin: 'classes': 'collapse' does not work → newforms-admin: 'classes': 'collapse' does not work (in one case) |
Triage Stage: | Unreviewed → Accepted |
That's a very specific case for which collapse doesn't work, it does work in general. I'll attach a patch to fix the multi-field line case. The problem is that the errors() method for FieldLine joins the errors from each field with newlines, resulting in at least one newline if there is more than one field even if there are no errors. Stripping newlines after the join fixes this and does not change the visible output in cases where there are errors. (Note when there are errors, it may be difficult to determine what field a particular error message references, but that was the case both before and after the fix.)
As for setting the fieldset name to None breaking collapse, I cannot recreate that, unless by 'breaking' you mean that you get a collapsed fieldset that you cannot uncollapse because there is no header line on which to hang the "Show" link. IMO you just shouldn't do that. If you mean something else please open a different ticket to explain what you see as wrong and track fixing it.
by , 16 years ago
comment:6 by , 16 years ago
Cc: | added |
---|
comment:8 by , 16 years ago
Cc: | added |
---|
comment:9 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
AFAIK the syntax has changed to 'classes': collapse