File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1351,6 +1351,23 @@ def test_localize_templatetag_and_filter(self):
1351
1351
self .assertEqual (template2 .render (context ), output2 )
1352
1352
self .assertEqual (template3 .render (context ), output3 )
1353
1353
1354
+ def test_unlocalize_honor_date_settings (self ):
1355
+ filter_template = Template (
1356
+ "{% load l10n %}Localized: {{ date }}. Unlocalized: {{ date|unlocalize }}."
1357
+ )
1358
+ tag_template = Template (
1359
+ "{% load l10n %}Localized: {{ date }}. {% localize off %}Unlocalized: "
1360
+ "{{ date }}{% endlocalize %}."
1361
+ )
1362
+ context = Context ({"date" : datetime .date (2024 , 12 , 15 )})
1363
+ expected_result = "Localized: 15. Dezember 2024. Unlocalized: 15-12-2024."
1364
+ with (
1365
+ translation .override ("de" , deactivate = True ),
1366
+ self .settings (DATE_FORMAT = "j-m-Y" ),
1367
+ ):
1368
+ self .assertEqual (filter_template .render (context ), expected_result )
1369
+ self .assertEqual (tag_template .render (context ), expected_result )
1370
+
1354
1371
def test_localized_off_numbers (self ):
1355
1372
"""A string representation is returned for unlocalized numbers."""
1356
1373
template = Template (
You can’t perform that action at this time.
0 commit comments