Opened 16 years ago
Closed 12 years ago
#6953 closed Bug (fixed)
ModelForm as_FOO output places form fields for ManyToMany fields at bottom of html output.
Reported by: | Owned by: | Alex Gaynor | |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | django@…, dgouldin@…, sj@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have a ModelForm based on a model with two ManyToMany fields. Whenever I output the form using the as_FOO convenience methods, the ModelMultipleChoiceField widgets are placed at the end of the ouput, rather than at the top of the output, a la their position in the model.
Attachments (3)
Change History (22)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
comment:3 Changed 15 years ago by
Version: | SVN → newforms-admin |
---|
comment:4 Changed 15 years ago by
Version: | newforms-admin → SVN |
---|
What does this have to do with newforms-admin? It was originally opened with version SVN and anonymously changed to nfa. Reverting. If there's something nfa specific about this ticket please spell it out.
comment:5 Changed 15 years ago by
milestone: | → 1.0 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:6 Changed 15 years ago by
milestone: | 1.0 → post-1.0 |
---|
As a sort of cosmetic change, I think this can safely go post-1.0.
Changed 15 years ago by
comment:7 Changed 15 years ago by
Has patch: | set |
---|
Changed 15 years ago by
Attachment: | modelform-m2m.diff added |
---|
comment:8 Changed 15 years ago by
Cc: | django@… added |
---|
This patch definitely fixes the problem as I was experiencing it. If the patch is truly this simple, this should have made it into 1.0. This is NOT just a cosmetic defect. The order of fields in most forms is damn important, and if the only other option is to hardcode the fields in the right order in your templates, then this seems to be a significant issue.
Thanks for the patch Alex.
comment:9 Changed 15 years ago by
Owner: | changed from nobody to Alex Gaynor |
---|
comment:11 Changed 15 years ago by
Alex, it looks like the sorted builtin was added in Python 2.4:
http://docs.python.org/library/functions.html#sorted
Are we interested in keeping 2.3 support as specified here?
http://docs.djangoproject.com/en/dev/topics/install/#install-python
comment:12 Changed 15 years ago by
Yeah, I have a branch on github with my work on this and I added the whole conditional import of sorted thing for compatibility, it's the modelform-m2m branch :)
comment:14 Changed 14 years ago by
I just hit this bug as well. What's holding the patch up? Seems trivial to me.
comment:15 Changed 14 years ago by
Cc: | sj@… added |
---|
comment:16 Changed 13 years ago by
Same patch updated for current trunk. Please test and move to ready for checkin if it works for you too.
Changed 13 years ago by
Attachment: | 6953.2.diff added |
---|
comment:17 Changed 13 years ago by
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:18 Changed 12 years ago by
Triage Stage: | Accepted → Ready for checkin |
---|
Example Model:
Example ModelForm:
Example as_FOO output: