Opened 17 years ago
Closed 17 years ago
#6220 closed (wontfix)
Search fields fails if the field names are unicode objects
Reported by: | 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: | no | UI/UX: | no |
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)
Change History (3)
by , 17 years ago
Attachment: | unicode_search_fields.diff added |
---|
comment:1 by , 17 years ago
Summary: | old admin: search fields fails if the field names are unicode objects → Search fields fails if the field names are unicode objects |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
Version: | SVN → 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 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → 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.
apply smart_str to search_fields in admin.