Django

Code

Changeset 6200

Show
Ignore:
Timestamp:
09/14/07 13:36:04 (1 year ago)
Author:
jacob
Message:

Fixed #5448: you can now use unicode characters in primary keys. Thanks, pigletto.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r6193 r6200  
    233233    phil.h.smith@gmail.com 
    234234    Gustavo Picon 
     235    pigletto 
    235236    Luke Plant <http://lukeplant.me.uk/> 
    236237    plisk 
  • django/trunk/django/db/models/base.py

    r6187 r6200  
    1313from django.utils.datastructures import SortedDict 
    1414from django.utils.functional import curry 
    15 from django.utils.encoding import smart_str, force_unicode 
     15from django.utils.encoding import smart_str, force_unicode, smart_unicode 
    1616from django.conf import settings 
    1717from itertools import izip 
     
    214214        # Note: the comparison with '' is required for compatibility with 
    215215        # oldforms-style model creation. 
    216         pk_set = pk_val is not None and pk_val != u'' 
     216        pk_set = pk_val is not None and smart_unicode(pk_val) != u'' 
    217217        record_exists = True 
    218218        if pk_set: 
  • django/trunk/tests/modeltests/custom_pk/models.py

    r5876 r6200  
     1# -*- coding: utf-8 -*- 
    12""" 
    2314. Using a custom primary key 
     
    9394[<Business: Sears>] 
    9495 
     96# Primary key may be unicode string 
     97>>> emp = Employee(employee_code='jaźń') 
     98>>> emp.save() 
     99 
    95100"""}