Code

Opened 6 years ago

Closed 6 years ago

#9129 closed (fixed)

unicode support on admin delete

Reported by: Ricardo Owned by: nobody
Component: contrib.admin Version: 1.0
Severity: Keywords: unicode, admin, delete
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation:
Needs tests: Patch needs improvement:
Easy pickings: UI/UX:

Description

Having the admin app in other language (portuguese, btw) and while trying to delete a record holding non-ascii characters it fails with:

'ascii' codec can't encode character u'\x??' in position ?: ordinal not in range(128)

I replaced contrib.admin.options.py, in delete_view()

if request.POST: # The user has already confirmed the deletion.
  if perms_needed:
     raise PermissionDenied
     obj_display = str(obj)
     obj.delete()

with

if request.POST: # The user has already confirmed the deletion.
  if perms_needed:
     raise PermissionDenied
     obj_display = u"%s" % obj
     obj.delete()

looks ok.

I hold revision 8600 but diff'd against 9000 (haven't had time to sort django-multilingual difference)

Attachments (1)

t9129-r9067.diff (534 bytes) - added by ramiro 6 years ago.
A possible fix using force_unicode()

Download all attachments as: .zip

Change History (2)

Changed 6 years ago by ramiro

A possible fix using force_unicode()

comment:1 Changed 6 years ago by kmtracey

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

(In [9070]) Fixed #9129 -- Restored a force_unicode that was lost when unicode changes were merged to newforms-admin. Thanks Ricardo & Ramiro.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.