Opened 6 years ago

Closed 5 years ago

#12966 closed (fixed)

Unicode pluralnames doesn`t work well with InlineAdmin

Reported by: IsakovAN Owned by: nobody
Component: contrib.admin Version: 1.1
Severity: Keywords: unicode
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by ramiro)

contrib/admin/options.py:

                    change_message.append(_('Added %(name)s "%(object)s".')
                                          % {'name': added_object._meta.verbose_name,
                                             'object': force_unicode(added_object)})
                for changed_object, changed_fields in formset.changed_objects:
                    change_message.append(_('Changed %(list)s for %(name)s "%(object)s".')
                                          % {'list': get_text_list(changed_fields, _('and')),
                                             'name': changed_object._meta.verbose_name,
                                             'object': force_unicode(changed_object)})
                for deleted_object in formset.deleted_objects:
                    change_message.append(_('Deleted %(name)s "%(object)s".')
                                          % {'name': deleted_object._meta.verbose_name,
                                             'object': force_unicode(deleted_object)})

Inline admin caught exception OrdinalNotInRange if XXX_object._meta.verbose_name is UTF-8 text. I have fix that wrapping XXX_object._meta.verbose_name with force_unicode function:

'name': force_unicode(changed_object._meta.verbose_name),

Change History (2)

comment:1 Changed 5 years ago by ramiro

  • Description modified (diff)
  • Has patch unset
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

(formatted description, unticket has_patch)

comment:2 Changed 5 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

(In [12627]) Fixed #12966 - Force unicode of verbose labels in admin change messages.

Note: See TracTickets for help on using tickets.
Back to Top