Skip to content

Commit

Permalink
Fixed #2
Browse files Browse the repository at this point in the history
  • Loading branch information
and3rson committed Dec 2, 2016
1 parent 1537227 commit a5730b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ python:
install:
- pip install tox coverage python-coveralls
script:
- tox -e py27-110
- tox
- coverage combine
- coverage report
after_success:
Expand Down
10 changes: 2 additions & 8 deletions searchableselect/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@
from django.apps import apps
get_model = apps.get_model

# Python 3.x
try:
UNICODE_EXISTS = bool(type(unicode))
except NameError:
def unicode(s):
str(s)

from django.utils.encoding import smart_str
from django.http import JsonResponse
from django.contrib.admin.views.decorators import staff_member_required

Expand All @@ -27,7 +21,7 @@ def filter_models(request):

values = model.objects.filter(**{'{}__icontains'.format(search_field): value})[:10]
values = [
dict(pk=v.pk, name=unicode(v))
dict(pk=v.pk, name=smart_str(v))
for v
in values
]
Expand Down

0 comments on commit a5730b5

Please sign in to comment.