#10877: search_fields raise TypeError if field names are given as unicode
objects.
----------------------------------+-----------------------------------------
Reporter: jcd | Owner: nobody
Status: new | Milestone:
Component: django.contrib.admin | Version: 1.0
Keywords: | Stage: Unreviewed
Has_patch: 0 |
----------------------------------+-----------------------------------------
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.
--
Ticket URL: <http://code.djangoproject.com/ticket/10877>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---