On Sep 4, 2:49 pm, mwebs <[EMAIL PROTECTED]> wrote:
> Is there a way to determine whether the model´s save()-method
> performs an insert or an update?
>
> I want to do something like this:
>
> create modelA_Instance --> create modelB_Instance.
>
> So my plan is to do this in the save() from modelA.

You can check instance.id.  Should be none on create else update.  So
in save

if self.id is None:
  #do stuff
else:
  #do other stuff

I don't know if this is the correct "django" way, but I have been
doing this with out any issues.

John
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to