Ticket #555: django-core-meta-init.py.diff
File django-core-meta-init.py.diff, 816 bytes (added by , 19 years ago) |
---|
-
django/core/meta/__init__.py
1027 1027 if opts.has_auto_field and not pk_set: 1028 1028 setattr(self, opts.pk.attname, db.get_last_insert_id(cursor, opts.db_table, opts.pk.column)) 1029 1029 db.db.commit() 1030 1031 # Update the auto_now and auto_now_add fields to the values just inserted 1032 # into the database 1033 i = 0 1034 for f in non_pks: 1035 if isinstance(f, DateField): 1036 if f.auto_now or (f.auto_now_add and not record_exists): 1037 setattr(self, f.attname, db_values[i]) 1038 i += 1 1039 1030 1040 # Run any post-save hooks. 1031 1041 if hasattr(self, '_post_save'): 1032 1042 self._post_save()