Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #5102 -- Fixed model saving so that 0 can be used as a primary …

…key value. Thanks, oggie rob.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6ed780d7964a526d332bbd5eedd233347231bf59 1 parent 8b115c7
@malcolmt malcolmt authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  django/db/models/
2  django/db/models/
@@ -209,7 +209,7 @@ def save(self, raw=False):
# First, try an UPDATE. If that doesn't update anything, do an INSERT.
pk_val = self._get_pk_val()
- pk_set = bool(pk_val)
+ pk_set = pk_val is not None
record_exists = True
if pk_set:
# Determine whether a record with the primary key already exists.
Please sign in to comment.
Something went wrong with that request. Please try again.