Ticket #2160: 0_pk.patch

File 0_pk.patch, 539 bytes (added by Chris Beaven, 18 years ago)
  • django/db/models/base.py

     
    167167
    168168        # First, try an UPDATE. If that doesn't update anything, do an INSERT.
    169169        pk_val = self._get_pk_val()
    170         pk_set = bool(pk_val)
     170        pk_set = bool(pk_val) or pk_val == 0
    171171        record_exists = True
    172172        if pk_set:
    173173            # Determine whether a record with the primary key already exists.
Back to Top