In Django 1.4, do Form.has_changed() and Form.changed_data, which are undocumented, work as expected?

Viewed 12597

From the source code, you can see that Django 1.4's Form class has a has_changed() method and changed_data property which seem rather useful, but are undocumented. My question is: do these work as expected, i.e.:

  • In Form.clean(), Form.has_changed() returns True if any any form data has changed, otherwise False
  • In Form.clean(), Form.changed_data is a list of field names whose values have changed.

If so, are there any specific reasons not to use them, apart from the usual caveats/dangers about using undocumented features (i.e. subject to change, not supported, etc.)?

NOTE 1: For these to work with custom widgets, those widgets need to have a _has_changed() method, which is defined for built in widgets.

NOTE 2: Interestingly, the documentation does include an offhand mention of the Formset.has_changed() method, but not of Form.has_changed().

3 Answers
Related