In a django model custom save() method, how should you identify a new object?

Posted by MikeN on Stack Overflow See other posts from Stack Overflow or by MikeN
Published on 2009-05-25T18:45:28Z Indexed on 2010/06/01 6:03 UTC
Read the original article Hit count: 155

Filed under:
|

I want to trigger a special action in the save() method of a Django model object when I'm saving a new record (not updating an existing record.)

Is the check for (self.id != None) necessary and sufficient to guarantee the self record is new and not being updated? Any special cases this might overlook?

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models