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

min_num conflicts with deletions of inlines #101

Closed
MarkBird opened this issue Jun 6, 2018 · 0 comments
Closed

min_num conflicts with deletions of inlines #101

MarkBird opened this issue Jun 6, 2018 · 0 comments

Comments

@MarkBird
Copy link

MarkBird commented Jun 6, 2018

Hopefully I can explain this clearly:

On a nested admin page set up like this

ParentAdmin
-- inline ChildAdmin
---- inline GrandChildAdmin

where Child is a many to many of Parent, and GrandChild is a many to many of Child,

that has min_num = 1 on GrandChildAdmin.

In this case, GrandChildAdmin.min_num = 1 was added after existing data was populated. Some of the existing data will have Child records that have no GrandChildren.

User tries to edit a Parent record that has Child records with no GrandChildren and delete a Child record with no GrandChildren. On save, the delete fails, with the error message This Field Is Required on GrandChildren.

If user adds a GrandChild just to be able to delete the Child, this also errors on save because the Child record is deleted first, then the insert into the Many To Many through table fails with a foreign key violation.

Can we ignore min_num validation on deletes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant