Permalink
Browse files

Performance and sorting fixes

  • Loading branch information...
1 parent 4d71061 commit c4d1fc605b910831d8a92e05ce8c6bf38b048414 @hcarvalhoalves committed Apr 4, 2012
Showing with 6 additions and 2 deletions.
  1. +2 −0 REQUIREMENTS
  2. +2 −2 taggitext/views.py
  3. +2 −0 taggitext_dev/settings.py
View
@@ -1,2 +1,4 @@
django>=1.4
django-taggit
+coverage
+django-coverage
View
@@ -12,8 +12,8 @@
def search_tags(request):
try:
query = request.GET['q']
- tags = Tag.objects.filter(name__icontains=query)
- response = list(tags.values_list('name', flat=True)[:RESULTS])
+ tags = Tag.objects.filter(name__icontains=query).values_list('name', flat=True)[:RESULTS]
+ response = sorted(tags, key=lambda t: len(t))
return HttpResponse(dumps(response), mimetype='application/json')
except KeyError:
return HttpResponseBadRequest()
@@ -158,3 +158,5 @@
},
}
}
+
+TEST_RUNNER = 'django_coverage.coverage_runner.CoverageRunner'

0 comments on commit c4d1fc6

Please sign in to comment.