On Tue, Oct 6, 2009 at 12:57 PM, Aaron <aa...@genieknows.com> wrote:

>
> On Oct 6, 1:30 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> > The only sure way to know what primary key is going to be assigned by the
> DB
> > is to actually save the object to the DB and see what got assigned.
>
> O.K. Now, when I get the ID after saving the object and perform some
> logic on it, I'll want to store my result in one of of the model's
> other fields.  Does that mean I'll have to call "super(MyModel,
> self).save(force_insert, force_update)" a second time?
>
>
Yes, you'll have to save the change to the DB.  But note if you were called
with force_insert=True you do not want to call the superclass save with
force_insert=True twice.

Personally I'd look pretty closely at the need to store a value dependent on
the primary key in some other field of the model.  Is this really absolutely
necessary?

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to