Ticket #1584: auto_now_add_fix.2.diff

File auto_now_add_fix.2.diff, 546 bytes (added by Andy Dustman <farcepest@…>, 19 years ago)

Better bug fix (evaluation order matters)

  • django/db/models/fields/__init__.py

     
    423423        return Field.get_db_prep_lookup(self, lookup_type, value)
    424424
    425425    def pre_save(self, value, add):
    426         if self.auto_now or (self.auto_now_add and add):
     426        if self.auto_now or (self.auto_now_add and add and not value):
    427427            return datetime.datetime.now()
    428428        return value
    429429
Back to Top