django/django — pull request #2706 by mjtamlyn (2014-05-24 09:58:10+00:00)
Title: Fixed #22510 -- Harden field removal to only None.

Refs #8620.

If we allow any value to remove form fields then we get name clashes with method names, media classes etc. There was a backwards incompatibility introduced meaning ModelForm subclasses with declared fields called media or clean would lose those fields.

Field removal is now only permitted by using the sentinel value None. The docs have been slightly reworded to refer to removal of fields rather than shadowing.

Notes for review:
- There is an alternative approach which is to add a new feature `ignore_fields` or similar to remove fields.
- Another alternative is to roll back the whole feature and document using `del` with `base_fields`. However as the only current documentation of `base_fields` says "don't touch this", I think this would be inadvisable. Personally, I also like the more declarative style.