﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23445	Removing a key from Form.fields keyOrder no longer hides elements	Thom Wiggers	nobody	"There was a bit of undocumented behaviour in using the `SortedDict`'s `keyOrder` that allowed it to be used to hide fields on rendering a form. Since this now uses `collections.OrderedDict` this behaviour has been broken (along with the rest of keyOrder):

Example:


{{{
class BlaForm(Form):
    field_a = CharField(...)
    field_b = CharField(...)

    def __init__(*args, **kwargs):
        self.fields.keyOrder.remove('field_a')
}}}    
This would make it not show up in the rendered form at all. Somewhere later you could still access the (initial) value of `field_a`:

{{{
form.cleaned_data['field_a']
}}}

This is not possible if you use `del` to remove the field from `self.fields`, the normal way to do this.

This feature was pretty useful when subclassing forms that had more fields than you needed in all versions while sharing data processing stuff.

This was undocumented behaviour, so this functionality might not need to be restored. However, a note on the 'breaking changes' page is warranted, imho.

There is also still a reference to `keyOrder` on https://code.djangoproject.com/wiki/CookBookNewFormsFieldOrdering."	Bug	closed	Forms	1.7	Normal	wontfix			Unreviewed	0	0	0	0	0	0
