Getting changed data from formsets

I am able to get the data that changed on the anchor/main model in an inlineformset. However getting same for all dependent forms bearing changed data eludes me.

Consider the relationship between Head and Staff in:


I am able to get form.changed_data for the form representing Head. However, doing the same for associated forms for Staff is a mystery to me. formset does not have changed_data property. All I can see is a miserable has_changed property which doesn’t offer any data for further processing. How do I get the changed data in all instances of StaffForm associated with Head in a formset?

Any ideas?

I’d suggest checking the changed_data attribute for each of the individual forms within the formset. (I don’t know if that’s going to work, but that’s what I would try.)

is formset and iterable? gives an iterable (list?) of Model objects … Any way to iterate formsets?

Yes, a formset is iterable.

See the docs and examples at Formsets | Django documentation | Django