BaseForm loses field sorting
|Reported by:||SmileyChris||Owned by:||adrian|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Came across this in a project just now when I had overridden BaseForm for a special form of my own. The fields were coming out in a different order from what I had specified.
The reason is that the __init__ of BaseForm does:
self.fields = self.base_fields.copy()
Even if base_fields is a SortedDict, .copy() is just the normal dict function so fields becomes a dict class and loses field sorting.
Simple patch attached.
Change History (4)
Changed 9 years ago by SmileyChris
comment:1 Changed 9 years ago by Simon G. <dev@…>
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Ready for checkin