Code

Opened 6 years ago

Closed 6 years ago

#6220 closed (wontfix)

Search fields fails if the field names are unicode objects

Reported by: Robert Bunting <robert@…> Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords: unicode search_fields
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Using r5458 (but this still looks valid),
If I define the search_fields in my admin model as

class Admin:
    search_fields = (u'description', u'image')

searches fail with arguments to __init__ must be strings
though if I use

class Admin:
    search_fields = ('description', 'image')

then of course it's ok.

Unicode objects should be ok here, so I just need to apply smart_str to the field names while making the search Q object. See simple patch.

Attachments (1)

unicode_search_fields.diff (799 bytes) - added by Robert Bunting <robert@…> 6 years ago.
apply smart_str to search_fields in admin.

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by Robert Bunting <robert@…>

apply smart_str to search_fields in admin.

comment:1 Changed 6 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from old admin: search fields fails if the field names are unicode objects to Search fields fails if the field names are unicode objects
  • Triage Stage changed from Unreviewed to Design decision needed
  • Version changed from SVN to newforms-admin

Not worth fixing on trunk, since you can just use normal strings in the Admin specification (they are referring to Python attributes, which must be ASCII, so this isn't restricting the possibilities at all) and we're trying to reduce the changes to existing admin to showstoppers only at this point.

Moving to the newforms-admin branch so that somebody can check the problem is handled there (or Joseph can decide to wontfix it).

comment:2 Changed 6 years ago by jkocherhans

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

Closing as wontfix due to the reasons Malcolm listed above. The items in fields refer to python attributes, which must be ASCII. Allowing unicode objects is misleading at best. Perhaps some sort of validator is in order to give a more friendly error, but it isn't a priority.

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.