Re: how to reject save of a model with many to many relation

2008-09-26 Thread Ottavio Campana
On 25 Set, 22:31, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > You should consider using a custom ModelForm[1] instead of this > approach. Override its clean() method to perform your checks and throw > a ValidationError when you don't want the save to proceed. You can > then also make the Admin use

Re: how to reject save of a model with many to many relation

2008-09-25 Thread Rajesh Dhawan
> I have two models, one of them has a many to many relation to the > other one. > > I want to add some checks to the first model, so I overwrote the save > method. If my checks are not ok, I plan not to call super().save(), > but this gives me the error "'FirstModel' instance needs to have a >

how to reject save of a model with many to many relation

2008-09-25 Thread Ottavio Campana
I have two models, one of them has a many to many relation to the other one. I want to add some checks to the first model, so I overwrote the save method. If my checks are not ok, I plan not to call super().save(), but this gives me the error "'FirstModel' instance needs to have a primary key