# Getting changed data from formsets

**URL:** <https://forum.djangoproject.com/t/getting-changed-data-from-formsets/22356>\
**Category:** Forms & APIs\
**Created:** [July 17, 2023, 3:59pm UTC](https://forum.djangoproject.com/t/getting-changed-data-from-formsets/22356 "2023-07-17T15:59:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![onyeibo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/onyeibo/32/11494_2.png) [@onyeibo](https://forum.djangoproject.com/u/onyeibo)\
**Post date:** [July 17, 2023, 3:59pm UTC](https://forum.djangoproject.com/t/getting-changed-data-from-formsets/22356/1 "2023-07-17T15:59:48Z")

</div>

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:

```auto
forms.inlineformset_factory(
    Head,
    Staff,
    form=StaffForm,
    extra=1,
    min_num=1,
    max_num=20,
    can_delete=True,
)

```

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?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [July 17, 2023, 4:10pm UTC](https://forum.djangoproject.com/t/getting-changed-data-from-formsets/22356/2 "2023-07-17T16:10:29Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![onyeibo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/onyeibo/32/11494_2.png) [@onyeibo](https://forum.djangoproject.com/u/onyeibo)\
**Post date:** [July 17, 2023, 4:20pm UTC](https://forum.djangoproject.com/t/getting-changed-data-from-formsets/22356/3 "2023-07-17T16:20:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [July 17, 2023, 4:36pm UTC](https://forum.djangoproject.com/t/getting-changed-data-from-formsets/22356/4 "2023-07-17T16:36:13Z")

</div>

Yes, a formset is iterable.

See the docs and examples at [Formsets | Django documentation | Django](https://docs.djangoproject.com/en/4.2/topics/forms/formsets/#django.forms.formsets.BaseFormSet)
