Django

Code

Changeset 6269

Show
Ignore:
Timestamp:
09/15/07 04:14:51 (10 months ago)
Author:
mtredinnick
Message:

Fixed #4879 -- Added 'created' arg to post_save signal. This is True is a new object is created. Patch from George Vilches.

Fully backwards compatible, because signal receivers do not have to be able to accept all the arguments (thankyou, robust_apply()).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r6256 r6269  
    297297    Geert Vanderkelen 
    298298    viestards.lists@gmail.com 
     299    George Vilches <gav@thataddress.com> 
    299300    Vlado <vlado@labath.org> 
    300301    Milton Waddams 
  • django/trunk/django/db/models/base.py

    r6200 r6269  
    248248                cursor.execute(subsel, (getattr(self, self._meta.order_with_respect_to.attname),)) 
    249249                db_values.append(cursor.fetchone()[0]) 
     250            record_exists = False 
    250251            if db_values: 
    251252                cursor.execute("INSERT INTO %s (%s) VALUES (%s)" % \ 
     
    262263 
    263264        # Run any post-save hooks. 
    264         dispatcher.send(signal=signals.post_save, sender=self.__class__, instance=self) 
     265        dispatcher.send(signal=signals.post_save, sender=self.__class__, 
     266                instance=self, created=(not record_exists)) 
    265267 
    266268    save.alters_data = True