#27296: Can't use custom formats with new language-independent LogEntry's 
messages
in Django 1.10
--------------------------------+--------------------
     Reporter:  Ivan Tsouvarev  |      Owner:  nobody
         Type:  Uncategorized   |     Status:  new
    Component:  Uncategorized   |    Version:  1.10
     Severity:  Normal          |   Keywords:
 Triage Stage:  Unreviewed      |  Has patch:  0
Easy pickings:  0               |      UI/UX:  0
--------------------------------+--------------------
 Say, you have some model, which `__str__` uses
 `django.utils.formats.date_format` with custom format string.

 `settings.FORMAT_MODULE_PATH` contains module, in which this string is
 defined.

 So, when you create object of this model via admin interface, the
 following things happen:
 1. Django calls `construct_change_message` to create LogEntry, which is
 decorated with `@translation_override(None)`, which will deactivate
 current language
 2. To write object representation with custom format in change message,
 `django.utils.formats.get_format` will be called
 3. `get_format` will try to find custom format, but it can't be done when
 active language is None, so original string will be returned as-is
 4. `django.utils.dateformat.format` will interpret custom format string
 literally, which may not fail with exception, but will be totally wrong
 anyway

--
Ticket URL: <https://code.djangoproject.com/ticket/27296>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.39a2947345edf8b460c3b6cc472151c0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to