Re: overriding model.save()

2010-08-05 Thread Alec Shaner
want to see if b is a special value before saving. > > -Original Message- > From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com] > On Behalf Of Sam Lai > Sent: Thursday, August 05, 2010 7:58 AM > To: django-users@googlegroups.com > Subject: Re: overriding mo

RE: overriding model.save()

2010-08-05 Thread Sells, Fred
lto:django-us...@googlegroups.com] On Behalf Of Sam Lai Sent: Thursday, August 05, 2010 7:58 AM To: django-users@googlegroups.com Subject: Re: overriding model.save() On 5 August 2010 03:05, Sells, Fred wrote: > I would like to prevent saving a new value if the database contains a > specific

Re: overriding model.save()

2010-08-05 Thread Sam Lai
On 5 August 2010 03:05, Sells, Fred wrote: > I would like to prevent saving a new value if the database contains a > specific value.  This is on a per field, per record basis. > > If I override the save() method; is there a way to find the existing (in > the DB) values and the new (to be stored) v

Re: overriding model.save()

2010-08-05 Thread Paulo Almeida
I never tried this, but I think you could just delete the value from the form.cleaned_data dictionary, if you don't want it: if instance.my_field == some_value: del form.cleaned_data['my_field'] This would be in the view, before saving, so you wouldn't need to override anything. - Paulo On

overriding model.save()

2010-08-04 Thread Sells, Fred
I would like to prevent saving a new value if the database contains a specific value. This is on a per field, per record basis. If I override the save() method; is there a way to find the existing (in the DB) values and the new (to be stored) values? -- You received this message because you are

Re: overriding Model.save(), do I need to override Model.create() also?

2009-01-12 Thread alex.gay...@gmail.com
On Jan 12, 10:12 am, "David Zhou" wrote: > On Mon, Jan 12, 2009 at 10:10 AM, rabbi wrote: > > > Is it enough to override the Model.save() method or should I override > > Model.create() also? > > Just Model.save() should be enough.  In the past, I've used if not > self.id to case initial creati

Re: overriding Model.save(), do I need to override Model.create() also?

2009-01-12 Thread David Zhou
On Mon, Jan 12, 2009 at 10:10 AM, rabbi wrote: > > Is it enough to override the Model.save() method or should I override > Model.create() also? Just Model.save() should be enough. In the past, I've used if not self.id to case initial creation -- although I don't know if that's considered best p

overriding Model.save(), do I need to override Model.create() also?

2009-01-12 Thread rabbi
Is it enough to override the Model.save() method or should I override Model.create() also? Does the create() method delegate the creation process to the save() method, or does it bypass it? Thanks, Alex --~--~-~--~~~---~--~~ You received this message because you a