[Answered ]-Trouble overriding save method on Django model with ManyToManyField

2👍

There are two issues going on here. To directly answer your question, the error basically means: You cannot refer to any m2m relationship if the original object(an instance of Outfit here) is not saved in database.

Sounds like you are trying to do the validation in save() method, which is a pretty bad practice in django. The verification process should typically happen in Form that creates Outfit objects. To override default django form, please refer to django ModelAdmin.form. To understand how to do validation on django forms, check ModelForm validation.

If you want code to refer to for m2m validation, I found a good example from SO.

Leave a comment