[Solved]-AttributeError: 'AlumniResponseFormFormSet' object has no attribute 'new_objects'

9👍

I use save_formset instead of save_related and I was having the same problem until I realized that I missed two important lines inside the method:

instances = formset.save(commit=False)

at the beginning, and then, after loop instances to do something with each instance:

instance.save() #commit instance changes
formset.save_m2m() #commit the whole formset changes

at the end.

If you don’t call the save_m2m() method before return, the formset object won’t have the ‘new_objects’ attribute, needed in the construct_change_message(self, request, form, formsets) method in contrib/admin/options.py

So, this should be done for every inline you have in the main model, no matter whether you want to make something with it or not.

Leave a comment