1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Merged Unicode branch into trunk (r4952:5608). This should be fully

backwards compatible for all practical purposes.

Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2007-07-04 12:11:04 +00:00
parent 4c958b15b2
commit 953badbea5
193 changed files with 3005 additions and 1603 deletions

View File

@@ -17,7 +17,7 @@ class Person(models.Model):
favorite_moment = models.DateTimeField()
email = models.EmailField()
def __str__(self):
def __unicode__(self):
return self.name
__test__ = {'API_TESTS':"""
@@ -42,7 +42,7 @@ __test__ = {'API_TESTS':"""
>>> p = Person(**dict(valid_params, id='foo'))
>>> p.validate()
{'id': ['This value must be an integer.']}
{'id': [u'This value must be an integer.']}
>>> p = Person(**dict(valid_params, id=None))
>>> p.validate()
@@ -76,7 +76,7 @@ False
>>> p = Person(**dict(valid_params, is_child='foo'))
>>> p.validate()
{'is_child': ['This value must be either True or False.']}
{'is_child': [u'This value must be either True or False.']}
>>> p = Person(**dict(valid_params, name=u'Jose'))
>>> p.validate()
@@ -88,7 +88,7 @@ u'Jose'
>>> p.validate()
{}
>>> p.name
'227'
u'227'
>>> p = Person(**dict(valid_params, birthdate=datetime.date(2000, 5, 3)))
>>> p.validate()
@@ -116,7 +116,7 @@ datetime.date(2000, 5, 3)
>>> p = Person(**dict(valid_params, birthdate='foo'))
>>> p.validate()
{'birthdate': ['Enter a valid date in YYYY-MM-DD format.']}
{'birthdate': [u'Enter a valid date in YYYY-MM-DD format.']}
>>> p = Person(**dict(valid_params, favorite_moment=datetime.datetime(2002, 4, 3, 13, 23)))
>>> p.validate()
@@ -144,10 +144,10 @@ u'john@example.com'
>>> p = Person(**dict(valid_params, email=22))
>>> p.validate()
{'email': ['Enter a valid e-mail address.']}
{'email': [u'Enter a valid e-mail address.']}
# Make sure that Date and DateTime return validation errors and don't raise Python errors.
>>> Person(name='John Doe', is_child=True, email='abc@def.com').validate()
{'favorite_moment': ['This field is required.'], 'birthdate': ['This field is required.']}
{'favorite_moment': [u'This field is required.'], 'birthdate': [u'This field is required.']}
"""}