Opened 17 years ago
Closed 14 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 by , 17 years ago
comment:2 by , 17 years ago
comment:3 by , 17 years ago
Version: | SVN → newforms-admin |
---|
comment:4 by , 17 years ago
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 by , 16 years ago
milestone: | → 1.0 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:6 by , 16 years ago
milestone: | 1.0 → post-1.0 |
---|
As a sort of cosmetic change, I think this can safely go post-1.0.
by , 16 years ago
comment:7 by , 16 years ago
Has patch: | set |
---|
by , 16 years ago
Attachment: | modelform-m2m.diff added |
---|
comment:8 by , 16 years ago
Cc: | 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 by , 16 years ago
Owner: | changed from | to
---|
comment:11 by , 16 years ago
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 by , 16 years ago
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 by , 15 years ago
I just hit this bug as well. What's holding the patch up? Seems trivial to me.
comment:15 by , 15 years ago
Cc: | added |
---|
comment:16 by , 14 years ago
Same patch updated for current trunk. Please test and move to ready for checkin if it works for you too.
by , 14 years ago
Attachment: | 6953.2.diff added |
---|
comment:17 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:18 by , 14 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Example Model:
Example ModelForm:
Example as_FOO output: