[Django] #24990: Admin Log change message display changed fields names (not label text nor fields' verbose names )

9 views
Skip to first unread message

Django

unread,
Jun 16, 2015, 4:58:43 PM6/16/15
to django-...@googlegroups.com
#24990: Admin Log change message display changed fields names (not label text nor
fields' verbose names )
-------------------------------+--------------------
Reporter: RamezIssac | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------
When an object is edited from the admin,
ModelAdmin.construct_change_message() report the changed fields by their
form's name instead of their label value or even field verbose name.

This 'might be ok' only if the field names are equal to label text and in
English
If the active language is not English, change message looks wired like
this:
عدل name (i.e. changed name)

You can see the cause of the issue here
https://github.com/django/django/blob/master/django/contrib/admin/options.py#L925-L926
And again with formsets 936
https://github.com/django/django/blob/master/django/contrib/admin/options.py#L936

Not sure how to write a test for this .

My Proposed Fix:
Instead of sending form.changed_data to get_text_list, send their labels
{{{
translated_changed_fields = [form.fields[f].label for f in
form.changed_data]
change_message.append(_('Changed %s.') %
get_text_list(translated_changed_fields, _('and')))
}}}
And again with formset
{{{
translated_changed_fields = [formset.fields[f].label for f in
changed_fields]
#...
% {'list': get_text_list(translated_changed_fields, _('and')),
}}}


Regards;

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

Django

unread,
Jun 16, 2015, 5:14:46 PM6/16/15
to django-...@googlegroups.com
#24990: Admin Log change message display changed fields names (not label text nor
fields' verbose names )
-------------------------------+--------------------------------------
Reporter: RamezIssac | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.8
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* status: new => closed
* needs_docs: => 0
* resolution: => duplicate
* needs_tests: => 0
* needs_better_patch: => 0


Comment:

Duplicate of #12952

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

Reply all
Reply to author
Forward
0 new messages