mirror of
https://github.com/django/django.git
synced 2025-07-05 10:19:20 +00:00
[1.1.X] Added force_unicode to a test (needed for Python 2.3 compatibility).
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12607 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
121188e254
commit
14fbee6958
@ -362,6 +362,7 @@ ValidationError: [u'4 IS INVALID CHOICE']
|
|||||||
# Subclassing ErrorList #######################################################
|
# Subclassing ErrorList #######################################################
|
||||||
|
|
||||||
>>> from django.utils.safestring import mark_safe
|
>>> from django.utils.safestring import mark_safe
|
||||||
|
>>> from django.utils.encoding import force_unicode
|
||||||
>>>
|
>>>
|
||||||
>>> class TestForm(Form):
|
>>> class TestForm(Form):
|
||||||
... first_name = CharField()
|
... first_name = CharField()
|
||||||
@ -377,7 +378,7 @@ ValidationError: [u'4 IS INVALID CHOICE']
|
|||||||
... def as_divs(self):
|
... def as_divs(self):
|
||||||
... if not self: return u''
|
... if not self: return u''
|
||||||
... return mark_safe(u'<div class="error">%s</div>'
|
... return mark_safe(u'<div class="error">%s</div>'
|
||||||
... % ''.join([u'<p>%s</p>' % e for e in self]))
|
... % ''.join([u'<p>%s</p>' % force_unicode(e) for e in self]))
|
||||||
...
|
...
|
||||||
|
|
||||||
This form should print errors the default way.
|
This form should print errors the default way.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user