Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #14933 -- Added ability to SelectDateWidget to cope with new al…

…ternative month names added in [14900]. Thanks, alek and Claude Peroz.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15017 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit f0cd656ee085863d3a37f1bfb8351486428b4df2 1 parent b6ab88c
Jannis Leidel authored December 22, 2010
2  django/forms/extras/widgets.py
@@ -77,7 +77,7 @@ def render(self, name, value, attrs=None):
77 77
                 escaped = True
78 78
             elif char in 'Yy':
79 79
                 output.append(year_html)
80  
-            elif char in 'bFMmNn':
  80
+            elif char in 'bEFMmNn':
81 81
                 output.append(month_html)
82 82
             elif char in 'dj':
83 83
                 output.append(day_html)
8  tests/regressiontests/i18n/tests.py
@@ -341,6 +341,14 @@ def test_l10n_enabled(self):
341 341
         finally:
342 342
             deactivate()
343 343
 
  344
+        # Russian locale (with E as month)
  345
+        activate('ru')
  346
+        self.assertEqual(
  347
+                u'<select name="mydate_day" id="id_mydate_day">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31" selected="selected">31</option>\n</select>\n<select name="mydate_month" id="id_mydate_month">\n<option value="1">\u042f\u043d\u0432\u0430\u0440\u044c</option>\n<option value="2">\u0424\u0435\u0432\u0440\u0430\u043b\u044c</option>\n<option value="3">\u041c\u0430\u0440\u0442</option>\n<option value="4">\u0410\u043f\u0440\u0435\u043b\u044c</option>\n<option value="5">\u041c\u0430\u0439</option>\n<option value="6">\u0418\u044e\u043d\u044c</option>\n<option value="7">\u0418\u044e\u043b\u044c</option>\n<option value="8">\u0410\u0432\u0433\u0443\u0441\u0442</option>\n<option value="9">\u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c</option>\n<option value="10">\u041e\u043a\u0442\u044f\u0431\u0440\u044c</option>\n<option value="11">\u041d\u043e\u044f\u0431\u0440\u044c</option>\n<option value="12" selected="selected">\u0414\u0435\u043a\u0430\u0431\u0440\u044c</option>\n</select>\n<select name="mydate_year" id="id_mydate_year">\n<option value="2009" selected="selected">2009</option>\n<option value="2010">2010</option>\n<option value="2011">2011</option>\n<option value="2012">2012</option>\n<option value="2013">2013</option>\n<option value="2014">2014</option>\n<option value="2015">2015</option>\n<option value="2016">2016</option>\n<option value="2017">2017</option>\n<option value="2018">2018</option>\n</select>',
  348
+                SelectDateWidget(years=range(2009, 2019)).render('mydate', datetime.date(2009, 12, 31))
  349
+        )
  350
+        deactivate()
  351
+
344 352
         # English locale
345 353
 
346 354
         settings.USE_L10N = True

0 notes on commit f0cd656

Please sign in to comment.
Something went wrong with that request. Please try again.