summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-04-04 13:52:35 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-04-04 13:52:35 +0000
commitf529a1f12ea4f96f1d3de1458f77bcfdf4229879 (patch)
tree938f683821f241783b07b32411caacc3a7f5a3f4 /tests
parent56d56e5bac2923382fd10036dbe045412390362d (diff)
Fixed #3597 -- Fixed unicode encoding problem in form rendering. Thanks,
Georgi Stanojevski and Ville Säävuori. git-svn-id: http://code.djangoproject.com/svn/django/trunk@4924 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/forms/regressions.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/regressiontests/forms/regressions.py b/tests/regressiontests/forms/regressions.py
index 02b38ec58d..5daabc03af 100644
--- a/tests/regressiontests/forms/regressions.py
+++ b/tests/regressiontests/forms/regressions.py
@@ -11,11 +11,11 @@ It should be possible to re-use attribute dictionaries (#3810)
>>> TestForm(auto_id=False).as_p()
u'<p>F1: <input type="text" class="special" name="f1" maxlength="10" /></p>\n<p>F2: <input type="text" class="special" name="f2" /></p>'
-#######################
-# Tests for form i18n #
-#######################
+#######################
+# Tests for form i18n #
+#######################
There were some problems with form translations in #3600
-
+
>>> from django.utils.translation import gettext_lazy, activate, deactivate
>>> class SomeForm(Form):
... username = CharField(max_length=10, label=gettext_lazy('Username'))
@@ -26,4 +26,12 @@ There were some problems with form translations in #3600
>>> print f.as_p()
<p><label for="id_username">Benutzername:</label> <input id="id_username" type="text" name="username" maxlength="10" /></p>
>>> deactivate()
+
+Unicode decoding problems...
+>>> GENDERS = (('0', u'En tied\xe4'), ('1', u'Mies'), ('2', u'Nainen'))
+>>> class SomeForm(Form):
+... somechoice = ChoiceField(choices=GENDERS, widget=RadioSelect())
+>>> f = SomeForm()
+>>> f.as_p()
+u'<p><label for="id_somechoice_0">Somechoice:</label> <ul>\n<li><label><input type="radio" id="id_somechoice_0" value="0" name="somechoice" /> En tied\xe4</label></li>\n<li><label><input type="radio" id="id_somechoice_1" value="1" name="somechoice" /> Mies</label></li>\n<li><label><input type="radio" id="id_somechoice_2" value="2" name="somechoice" /> Nainen</label></li>\n</ul></p>'
"""