summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/models/base.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 064dc8fdec..1a0de4c827 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -209,7 +209,9 @@ class Model(object):
# First, try an UPDATE. If that doesn't update anything, do an INSERT.
pk_val = self._get_pk_val()
- pk_set = pk_val is not None
+ # Note: the comparison with '' is required for compatibility with
+ # oldforms-style model creation.
+ pk_set = pk_val is not None and pk_val != u''
record_exists = True
if pk_set:
# Determine whether a record with the primary key already exists.