Ticket #1584: auto_now_add_fix.diff

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

Bug fix (against magic-removal)

  • 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 (not value and self.auto_now_add and add):
    427427            return datetime.datetime.now()
    428428        return value
    429429
Back to Top