[Answered ]-Django: Check at model level if anything in ManyToMany field before saving

1👍

Whether you actually want to use the data from a field or just see if it is blank, the problem is caused by referencing the m2m field in any way before saving the object. I had a similar problem which I fixed using a custom form as per: https://stackoverflow.com/a/7986937/19837155

This might be more difficult when you’re using inlines, but it may be the easiest way to solve your problem.

Leave a comment