Saving model with raw=True

496 views
Skip to first unread message

Preston Timmons

unread,
Mar 16, 2009, 6:55:07 PM3/16/09
to Django users
At one time it seems there was an intention to have the save method on
models accept a keyword argument named raw which would allowed the
model to be saved without pre-processing. This argument is available
in the save_base method but not available in the save method.

Am I right to conclude that I should call save_base directly when I
want to use this?

Thanks.

Preston

Alex Gaynor

unread,
Mar 16, 2009, 6:59:02 PM3/16/09
to django...@googlegroups.com
What do you mena skipping the processing, right now what raw does is very internal and doesn't seem like behavior you'd ever want to chnage:
http://code.djangoproject.com/browser/django/trunk/django/db/models/base.py#L352

Alex

--
"I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire
"The people's good is the highest law."--Cicero

Preston Timmons

unread,
Mar 16, 2009, 9:17:39 PM3/16/09
to Django users
Thanks, Alex,

I must misunderstand what it is for then. I got the idea from a post
where Russ Magee mentioned it as being a way to prevent auto_now
fields from being executed:

http://groups.google.com/group/django-users/browse_thread/thread/167ee7bddccb4354/069a59146423d013?lnk=gst&q=auto_now#069a59146423d013

I needed to create a test that depended upon a 'date modified' field
of a model. That field used auto_now and it did not seem possible to
force a date. I have since solved the problem by moving the logic into
a custom save method but afterwards came upon the above post and
wondered if I wasn't missing something simple.

Preston




On Mar 16, 5:59 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Mon, Mar 16, 2009 at 6:55 PM, Preston Timmons
> <prestontimm...@gmail.com>wrote:
>
>
>
>
>
> > At one time it seems there was an intention to have the save method on
> > models accept a keyword argument named raw which would allowed the
> > model to be saved without pre-processing. This argument is available
> > in the save_base method but not available in the save method.
>
> > Am I right to conclude that I should call save_base directly when I
> > want to use this?
>
> > Thanks.
>
> > Preston
>
> What do you mena skipping the processing, right now what raw does is very
> internal and doesn't seem like behavior you'd ever want to chnage:http://code.djangoproject.com/browser/django/trunk/django/db/models/b...
Reply all
Reply to author
Forward
0 new messages