Skip to content
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

Fixes #12402 - When bulk-importing related objects, add the errors to the base form instead of the model_form #12408

Conversation

kkthxbye-code
Copy link
Contributor

Fixes: #12402

The errors of related models are currently added to the model_form. If there's any errors in a related object form, an AbortTransaction is thrown. The errors saved on the model form are never replicated to the base form and thus are never shown on the form.

I'm really unsure of the fix in this PR, but it seems to work. The code is pretty complex imo, a lot of different forms being passed around, so not sure if there's a better way. Feel free to just close this PR and fix it another way, just wanted to have it written down.

@jeremystretch
Copy link
Member

I think the root issue here is that the related object forms are not validated until after we've begun to save the parent object. We'll need to unwind some of the bulk logic to correct this.

@kkthxbye-code
Copy link
Contributor Author

the related object forms are not validated until after we've begun to save the parent object

I'm assuming this is because the clean methods do validation on the reference between the related object and the parent, so we need the pk of the parent before we can validate the related object?

Regardless, feel free to close this PR and un-assign me, it was mostly just a way to get the ball rolling 👍

@jeremystretch
Copy link
Member

Understood, and thanks for taking it on.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON import of circuit with terminations fails without error
2 participants