Hello,

according to the documentation, using {% localize off %} should be 
equivalent to {{ variable|unlocalize }}. However, for datetimes the former 
formats the variable according to DATETIME_FORMAT setting, while the latter 
does not and uses some default ISO based formatting.

I observe this for Django 1.11.4 and thing it is a bug I should report, but 
I would like to have this confirmed. My feeling is that the unlocalize 
filter should be:

@register.filter(is_safe=False)
def unlocalize(value):
    """
    Forces a value to be rendered as a non-localized value,
    regardless of the value of ``settings.USE_L10N``.
    """
    return force_text(formats.localize(value, use_l10n=False))

instead of 

@register.filter(is_safe=False)
def unlocalize(value):
    """
    Forces a value to be rendered as a non-localized value,
    regardless of the value of ``settings.USE_L10N``.
    """
    return force_text(value)

Could someone with better knowledge of the internals have a look at this?

Best regards

Beda

-- 
You received this message because you are subscribed to the Google Groups 
"Django internationalization and localization" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-i18n+unsubscr...@googlegroups.com.
To post to this group, send email to django-i18n@googlegroups.com.
Visit this group at https://groups.google.com/group/django-i18n.
For more options, visit https://groups.google.com/d/optout.

Reply via email to