[Django] #21113: django_admin_log table stores messages in different languages depending on which language was active while editing.

102 views
Skip to first unread message

Django

unread,
Sep 17, 2013, 9:53:44 AM9/17/13
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
-------------------------------+-----------------------------
Reporter: dimyur27@… | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.admin | Version: 1.6-beta-1
Severity: Normal | Keywords: admin logs i18n
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-----------------------------
In my project (in development) there are 3 different languages supported.
Admin site supposed to have 3 main superusers, each is a native speaker of
one of the languages. If one superuser edited an object, another one is
not able to read what his fellow superuser previously did, because "Change
history" page doesn't respect the current user language and displays the
messages in the language that was current when the changes took place.
Maybe change_message field should be removed and the messages generated
each time they are displayed.
So is object_repr, because object's representation may be dependant on the
current language too.
Thank you.

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

Django

unread,
Sep 19, 2013, 5:25:59 PM9/19/13
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------

Reporter: dimyur27@… | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by wim@…):

* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* version: 1.6-beta-1 => master
* needs_tests: => 0
* needs_docs: => 0


Comment:

Accepted. I'd like messages to be language-agnostic and translatable.

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:1>

Django

unread,
Oct 5, 2013, 2:12:21 PM10/5/13
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner: nobody
Type: New feature | Status: new

Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by timo):

* type: Uncategorized => New feature


--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:2>

Django

unread,
Jun 19, 2014, 9:22:10 PM6/19/14
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner: jooyous
Type: New feature | Status: assigned

Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by jooyous):

* owner: nobody => jooyous
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:3>

Django

unread,
Jun 20, 2014, 3:46:59 AM6/20/14
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner: jooyous
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by jooyous):

So at this point I understand how to change this so all subsequent log
entries behave correctly. But currently the translated strings are being
saved away as part of the object, and I think (?) this means we've lost
the information of the starting language, so the only way I can think of
fixing *existing* histories is by writing a script and having the user run
it, specifying their relevant languages?

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:4>

Django

unread,
Jun 20, 2014, 6:19:52 AM6/20/14
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner: jooyous
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by claudep):

Fixing existing history might be impossible to achieve. I wouldn't set
that as a goal for this ticket.

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:5>

Django

unread,
Jun 25, 2014, 6:18:03 AM6/25/14
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner: jooyous
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by anonymous):

I can't get ugettext to translate "Changed" for some reason, even though
there are bits of code where it does it successfully and I'm not sure what
I'm doing wrong.

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:6>

Django

unread,
Jun 25, 2014, 6:19:19 AM6/25/14
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner: jooyous
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by jooyous):

Replying to [comment:6 anonymous]:


> I can't get ugettext to translate "Changed" for some reason, even though
there are bits of code where it does it successfully and I'm not sure what
I'm doing wrong.

Whoops, that was me. Didn't realize I was logged out.

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:7>

Django

unread,
Jul 12, 2014, 5:19:52 PM7/12/14
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner: jooyous
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by jooyous):

Hellooo I am still working on this.

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:8>

Django

unread,
Oct 12, 2014, 1:37:16 AM10/12/14
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by jooyous):

* status: assigned => new
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* needs_tests: 0 => 1
* owner: jooyous =>


Comment:

https://github.com/django/django/pull/3345

Here's a partial fix for this bug. It changes the log messages so that
they're saved in the database in English and then parsed and translated
when they need to be displayed. However, due to the way the change
messages were written upon being entered into the database, I wasn't able
to properly distinguish between different types of save messages. For
example, if an object (for example, a Poll or Choice) contained a period
or quotation marks in the body, I could not tell the difference between
the end of the message and the punctuation within the message body. So I'm
only submitting a partial fix. From what I could test, it works pretty
well for Users. I was also having some trouble getting certain words to
translate.

If having history messages displayed in different languages is a priority,
I would recommend restructuring the logging functionality entirely, and
have the messages be saved in an unambiguously delimited format (yaml?
json? something!) so that they can be formed into translatable sentences
after they are extracted from the database. I would be willing to work on
this if an issue gets made!

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:9>

Django

unread,
Oct 12, 2014, 1:41:36 PM10/12/14
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by claudep):

Replying to [comment:9 jooyous]:
(...)


> If having history messages displayed in different languages is a
priority, I would recommend restructuring the logging functionality
entirely, and have the messages be saved in an unambiguously delimited
format (yaml? json? something!) so that they can be formed into
translatable sentences after they are extracted from the database. I would
be willing to work on this if an issue gets made!

Yes, I think that this would be the right approach.

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:10>

Django

unread,
Dec 26, 2015, 4:38:00 PM12/26/15
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by claudep):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0


Comment:

[https://github.com/django/django/pull/5879 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:11>

Django

unread,
Dec 28, 2015, 9:49:34 AM12/28/15
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


Comment:

Left comments for improvement on the pull request.

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:12>

Django

unread,
Dec 28, 2015, 5:08:10 PM12/28/15
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by Claude Paroz <claude@…>):

In [changeset:"35c41987ecfaad849019d09468ce322fec86cd39" 35c4198]:
{{{
#!CommitTicketReference repository=""
revision="35c41987ecfaad849019d09468ce322fec86cd39"
Moved LogEntry-related tests to their own test case

Thanks Tim Graham for reviewing and contributing to the patch.
Refs #21113.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:13>

Django

unread,
Dec 30, 2015, 9:45:55 AM12/30/15
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by claudep):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:14>

Django

unread,
Dec 30, 2015, 6:05:55 PM12/30/15
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by chmarr):

I know this is very late to the party, and it's not that critical of an
issue, but generally it is considered good form [citation-needed] to
ensure the top level of a JSON structure is an object/dictionary, rather
than a list, string, int, etc. `django.http.response.JsonResponse` for
example considers anything except a dict to be 'unsafe'.

The change is simple... just use `{'changes':[ ...]}` rather than simply
`[...]`, but this does involve changing the entire patch. 😦

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:15>

Django

unread,
Dec 31, 2015, 5:31:21 AM12/31/15
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by claudep):

Changing the entire patch is not an issue at all.

I would appreciate though if you could find some reference about this
design issue.

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:16>

Django

unread,
Jan 7, 2016, 9:49:09 AM1/7/16
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by timgraham):

From a bit of searching, I guess the "good form" is to mitigate
[http://haacked.com/archive/2009/06/25/json-hijacking.aspx/ JSON
hijacking]? Those concerns probably aren't relevant here.

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:17>

Django

unread,
Jan 7, 2016, 10:06:26 AM1/7/16
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


Comment:

Left a few more comments on the pull request.

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:18>

Django

unread,
Jan 7, 2016, 2:52:45 PM1/7/16
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
---------------------------------+------------------------------------
Reporter: dimyur27@… | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by claudep):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:19>

Django

unread,
Jan 7, 2016, 6:30:50 PM1/7/16
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
-------------------------------------+-------------------------------------
Reporter: dimyur27@… | Owner:
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: admin logs i18n | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:20>

Django

unread,
Jan 8, 2016, 2:37:00 PM1/8/16
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
-------------------------------------+-------------------------------------
Reporter: dimyur27@… | Owner: Claude
| Paroz <claude@…>
Type: New feature | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: admin logs i18n | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: new => closed
* owner: => Claude Paroz <claude@…>
* resolution: => fixed


Comment:

In [changeset:"cf7894be88f6c27680ef80796b883f6e3b709b8b" cf7894be]:
{{{
#!CommitTicketReference repository=""
revision="cf7894be88f6c27680ef80796b883f6e3b709b8b"
Fixed #21113 -- Made LogEntry.change_message language independent

Thanks Tim Graham for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:21>

Django

unread,
Jan 9, 2016, 1:42:41 PM1/9/16
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
-------------------------------------+-------------------------------------
Reporter: dimyur27@… | Owner: Claude
| Paroz <claude@…>
Type: New feature | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed
Keywords: admin logs i18n | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timgraham):

Possible flaky test seen [http://djangoci.com/job/django-master/1754/ on
Jenkins]:
{{{
admin_utils.test_logentry.LogEntryTests.test_logentry_change_message

Stacktrace

Traceback (most recent call last):
File "/mnt/jenkinsdata/workspace/django-
master/database/mysql/python/python3.5/tests/admin_utils/test_logentry.py",
line 65, in test_logentry_change_message
self.assertEqual(logentry.get_change_message(), 'Changed title and
hist.')
AssertionError: 'Changed something' != 'Changed title and hist.'
- Changed something
+ Changed title and hist.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:22>

Django

unread,
Jan 9, 2016, 1:47:30 PM1/9/16
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
-------------------------------------+-------------------------------------
Reporter: dimyur27@… | Owner: Claude
| Paroz <claude@…>
Type: New feature | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed
Keywords: admin logs i18n | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by claudep):

Probably an issue with `.latest()`, on MySQL, not by chance! We may find
another way to get the target logentry based on another criterion...

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:23>

Django

unread,
Jan 10, 2016, 1:19:09 PM1/10/16
to django-...@googlegroups.com
#21113: django_admin_log table stores messages in different languages depending on
which language was active while editing.
-------------------------------------+-------------------------------------
Reporter: dimyur27@… | Owner: Claude
| Paroz <claude@…>
Type: New feature | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed
Keywords: admin logs i18n | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz <claude@…>):

In [changeset:"4a03e6f27207ec7d9bb12d229da570633c086a92" 4a03e6f2]:
{{{
#!CommitTicketReference repository=""
revision="4a03e6f27207ec7d9bb12d229da570633c086a92"
Refs #21113 -- Updated test to allow for bad MySQL time resolution
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21113#comment:24>

Reply all
Reply to author
Forward
0 new messages