Ticket #3105: base.py.diff

File base.py.diff, 1.6 KB (added by Eric Van Dewoestine <ervandew@…>, 18 years ago)

django/db/models/base.py.diff

Line 
1*** base.py Wed Dec 6 08:58:14 2006
2--- base.py.new Wed Dec 6 08:58:09 2006
3***************
4*** 175,185 ****
5 (backend.quote_name(self._meta.db_table), backend.quote_name(self._meta.pk.column)), [pk_val])
6 # If it does already exist, do an UPDATE.
7 if cursor.fetchone():
8! db_values = [f.get_db_prep_save(f.pre_save(self, False)) for f in non_pks]
9 if db_values:
10 cursor.execute("UPDATE %s SET %s WHERE %s=%%s" % \
11 (backend.quote_name(self._meta.db_table),
12! ','.join(['%s=%%s' % backend.quote_name(f.column) for f in non_pks]),
13 backend.quote_name(self._meta.pk.column)),
14 db_values + [pk_val])
15 else:
16--- 175,186 ----
17 (backend.quote_name(self._meta.db_table), backend.quote_name(self._meta.pk.column)), [pk_val])
18 # If it does already exist, do an UPDATE.
19 if cursor.fetchone():
20! update_fields = [f for f in non_pks if f.update]
21! db_values = [f.get_db_prep_save(f.pre_save(self, False)) for f in update_fields]
22 if db_values:
23 cursor.execute("UPDATE %s SET %s WHERE %s=%%s" % \
24 (backend.quote_name(self._meta.db_table),
25! ','.join(['%s=%%s' % backend.quote_name(f.column) for f in update_fields]),
26 backend.quote_name(self._meta.pk.column)),
27 db_values + [pk_val])
28 else:
Back to Top