Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…key value. Thanks, oggie rob.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5933 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6ed780d7964a526d332bbd5eedd233347231bf59 1 parent 8b115c7
Malcolm Tredinnick authored

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  django/db/models/base.py
2  django/db/models/base.py
@@ -209,7 +209,7 @@ def save(self, raw=False):
209 209
 
210 210
         # First, try an UPDATE. If that doesn't update anything, do an INSERT.
211 211
         pk_val = self._get_pk_val()
212  
-        pk_set = bool(pk_val)
  212
+        pk_set = pk_val is not None
213 213
         record_exists = True
214 214
         if pk_set:
215 215
             # Determine whether a record with the primary key already exists.

0 notes on commit 6ed780d

Please sign in to comment.
Something went wrong with that request. Please try again.