Deleting inline model in Django admin

Posted by Overclocked on Stack Overflow See other posts from Stack Overflow or by Overclocked
Published on 2012-11-06T16:37:51Z Indexed on 2012/11/06 17:00 UTC
Read the original article Hit count: 194

Filed under:

I am trying to use Django admin to remove an inline model. I get an error saying

[u'Select a valid choice. That choice is not one of the available choices.']

I check the location where the exception is raised. It seems like the inline model was removed, then a form validation happened on the parent model with the deleted inline model still as value of the form. That caused the failure.

In my admin model, I had a save_formset method defined, that called formset.save(commit=False). Is the commit=False not telling Django to not delete the related models?

Thanks.

© Stack Overflow or respective owner

Related posts about django