#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.
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.85fb2f28da809abff6c4036f2a4b8f18%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.