          # First, try an UPDATE. If that doesn't update anything, do an INSERT.
          pk_val = self._get_pk_val()
          # 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.
              cursor.execute("SELECT 1 FROM %s WHERE %s=%%s" % \
                  (qn(self._meta.db_table), qn(self._meta.pk.column)),
 
</s> remove from django.utils.encoding import smart_str, force_unicode
 </s> add from django.utils.encoding import smart_str, force_unicode, smart_unicode
        pk_set = pk_val is not None and smart_unicode(pk_val) != u''
          # First, try an UPDATE. If that doesn't update anything, do an INSERT.
          pk_val = self._get_pk_val()
          # Note: the comparison with '' is required for compatibility with
          # oldforms-style model creation.
        pk_set = pk_val is not None and smart_unicode(pk_val) != u''
          record_exists = True
          if pk_set:
              # Determine whether a record with the primary key already exists.
              cursor.execute("SELECT 1 FROM %s WHERE %s=%%s" % \
                  (qn(self._meta.db_table), qn(self._meta.pk.column)),
keep keep keep keep replace keep keep keep keep keep
 Fixed #5448: you can now use unicode characters in primary keys. Thanks, pigletto.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6200 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/db/models/base.py