diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2007-08-17 15:05:54 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2007-08-17 15:05:54 +0000 |
| commit | fcec755f01cfaba2a85bfc9511876debbce98631 (patch) | |
| tree | e990effbcd90e4d405b0f9dcc70cb38e47b6f3dc /django/db/models/base.py | |
| parent | 0f92ac52cbf81fb2ac01755c558e2e6ad54700e8 (diff) | |
newforms-admin: Merged from trunk up to [5916]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@5918 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/base.py')
| -rw-r--r-- | django/db/models/base.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py index 528bf7fb06..85ddb79fff 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -218,11 +218,11 @@ class Model(object): record_exists = True if pk_set: # Determine whether a record with the primary key already exists. - cursor.execute("SELECT COUNT(*) FROM %s WHERE %s=%%s" % \ + cursor.execute("SELECT 1 FROM %s WHERE %s=%%s" % \ (backend.quote_name(self._meta.db_table), backend.quote_name(self._meta.pk.column)), self._meta.pk.get_db_prep_lookup('exact', pk_val)) # If it does already exist, do an UPDATE. - if cursor.fetchone()[0] > 0: + if cursor.fetchone(): db_values = [f.get_db_prep_save(raw and getattr(self, f.attname) or f.pre_save(self, False)) for f in non_pks] if db_values: cursor.execute("UPDATE %s SET %s WHERE %s=%%s" % \ |
