Opened 10 years ago

Closed 6 years ago

#12306 closed New feature (wontfix)

Checkbox (label, field) ordering

Reported by: EoghanM Owned by: nobody
Component: Forms Version: 1.1
Severity: Normal Keywords: label checkbox BooleanField
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


It is currently very difficult to reorder the default layout of fields:

<label for="x" ...>My Label:</label> <input id="x".../>

For checkboxes, this should be either:

<input id="x".../> <label for="x"...>My Label</label>


<label><input.../> My Label</label>

At the moment, in a template there's no way of knowing if a field is a BooleanField (in order to special case the html), and I don't know how I'd edit widgets etc. to override the current layout.

This has been touched on as a sore point elsewhere:

Where would be the best place to apply a patch for this?

  • At the form level: as a new argument to forms/, called 'checkbox_row' which for e.g. table rows would look like:
    u'<tr><td colspan="2">%(field)s%(label)s%(help_text)s%(errors)s</td></tr>'
  • At the field level: as a new boolean function 'is_checkbox'?
  • Both of the above?

Change History (6)

comment:1 Changed 9 years ago by Russell Keith-Magee

Triage Stage: UnreviewedDesign decision needed

I acknowledge the problem, but I'm not sure what the solution should be.

comment:2 Changed 9 years ago by Paul Oswald

You might want to look into this Django library which allows you to override the html of any form field:

More generally, it might make sense to incorporate that library into Django itself to allow users to apply their own markup preferences. It uses the django templating system to define the html and substitutes the field values in. The application creates html5-typed input elements but it could easily be used to output html in the current html 4 style by default. Can someone on the core team can make a call as to if this approach is acceptable?

comment:3 Changed 8 years ago by Matt McClanahan

Severity: Normal
Type: New feature

comment:4 Changed 7 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:5 Changed 7 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:6 Changed 6 years ago by Aymeric Augustin

Resolution: wontfix
Status: newclosed

I'm going to close this for the same reasons as #13401.

The long term solution is indeed something akin to floppyforms, but it hasn't been integrated yet due to performance concerns.

Note: See TracTickets for help on using tickets.
Back to Top