-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyError: 'changed_data' in nested_admin.formsets.save_existing_objects #245
Comments
@scottgigante did you ever figure this out? |
Unfortunately I did not -- I haven't been able to reproduce it. |
For me it happened when i used readonly inlines and changed the non-inline object:
And a custom pk field in the inline model:
|
I managed to address my error. Looking up at the exception stack, the initial exception thrown was a Model not found error. I have some complex model inheritance, polymorphism, and soft deletion going on, so without diving into all that: My issue was caused by one of the inline models of my ModelAdmin not being accessible/found by the methods that save because it was actually soft-deleted. It was present in the queryset that displayed records on the admin page (bug), but not in the queryset that was used to save objects (expected). Hence the front end was sending the soft-deleted object id in its payload that could not be found for updating, resulting in exceptions that propagated down to this error. |
Thanks @jordanvs for the follow-up! I also use soft deletion to filter querysets, so likely this is the same cause. |
nested_admin.formsets.save_existing_objects seems to be accessing a field that sometimes does not exist. I'm not quite sure how to generate a MRE here, but this is the traceback from my app logs.
The text was updated successfully, but these errors were encountered: