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
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
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
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
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
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
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
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
8 matches
Mail list logo