Opened 7 years ago
Closed 7 years ago
#28733 closed New feature (wontfix)
Formsets are missing classes to be easily styleable
Reported by: | Claude Paroz | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
With normal forms, it's easy to style widgets with CSS thanks to unique input ids (input#id_field_name
selector).
With formsets, as ids contain an index number, you cannot use the same strategy. To add some class to some field widget, you have to customize the formset form to add a custom widget to be able to specify an attrs={'class': 'special'})
parameter, which is much boilerplate code for a very common and simple addition.
I would suggest to automatically add class="fieldname"
on each formset widget.
Change History (2)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Ah thanks, awesome CSS3 selectors! Sorry for the noise.
I think a fairly strong justification is needed given the possibility that some unwanted CSS rules in a developer's stylesheet might start appearing on form fields. Did you consider using a CSS rule like
input[id$="-field_name"]
?