#10877 closed (worksforme)
search_fields raise TypeError if field names are given as unicode objects.
Reported by: | Cliff Dyer | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.0 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If you specify field names in search_fields as unicode objects, when you search you get the following exception:
Exception Type: TypeError Exception Value: __init__() keywords must be strings Exception Location: /usr/lib/python2.4/site-packages/django/contrib/admin/views/main.py in get_query_set, line 230
For example, the following code raises this TypeError
:
from django.contrib import admin class MyAdmin(admin.ModelAdmin) search_fields = [u'title']
This can be worked around by converting such unicode specified field names to strings:
search_fields = [str(field) for field in unicode_search_fields]
Other similar specifiers, such as 'list_filter' and 'exclude' handle unicode objects the same way they handle strings.
Change History (3)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Closing as worksforme since no new information has come to light.
comment:3 by , 15 years ago
Just found this searching for my username. Somehow I never saw the updates. I was indeed using 1.0.2 when I found this bug, for the record.
What version of Django are you using? Specifically if you are using 1.0.2 or less this has been fixed since(r10510).