Ticket #13339: ticket_13339_l10n_month_tests.diff
File ticket_13339_l10n_month_tests.diff, 2.1 KB (added by , 15 years ago) |
---|
-
regressiontests/i18n/tests.py
11 11 from django.test import TestCase 12 12 from django.utils.translation import ugettext, ugettext_lazy, activate, deactivate, gettext_lazy, to_locale 13 13 14 from forms import I18nForm, SelectDateForm, SelectDateWidget, CompanyForm 14 from forms import I18nForm, SelectDateForm, SelectDateWidget, CompanyForm, SimpleDateForm 15 15 16 16 17 17 class TranslationTests(TestCase): … … 411 411 settings.USE_THOUSAND_SEPARATOR = True 412 412 # Checking for the localized "products_delivered" field 413 413 self.assert_(u'<input type="text" name="products_delivered" value="12.000" id="id_products_delivered" />' in form6.as_ul()) 414 415 form7 = CompanyForm({ 416 'name': u'acme', 417 'date_added': "31.12.2009 12:31", 418 'cents_payed': "59,47", 419 'products_delivered': "12.000", 420 }) 421 self.assertEqual(True, form7.is_valid()) 422 423 form8 = SimpleDateForm({ 424 'date_field': "31. Dezember 2009", 425 }) 426 self.assertEqual(True, form8.is_valid()) 427 self.assertEqual( 428 form8.as_ul(), 429 u'<li><label for="id_date_field">Date field:</label> <input type="text" name="date_field" value="31. Dezember 2009" id="id_date_field" /></li>' 430 ) 431 432 414 433 finally: 415 434 deactivate() 416 435 -
regressiontests/i18n/forms.py
15 15 16 16 class CompanyForm(forms.ModelForm): 17 17 cents_payed = forms.DecimalField(max_digits=4, decimal_places=2, localize=True) 18 date_added = forms.DateTimeField(localize=True) 18 19 products_delivered = forms.IntegerField(localize=True) 19 20 20 21 class Meta: 21 22 model = Company 23 24 class SimpleDateForm(forms.Form): 25 date_field = forms.DateField()