1. Pedro Beck
  2. django-taggit-autosuggest


Fabian Topfstedt  committed dbad5fa

Changed views.py to user icontains instead of istartswith (thx @benbacardi)

  • Participants
  • Parent commits a816fca
  • Branches default

Comments (0)

Files changed (1)

File taggit_autosuggest/views.py

View file
 TAG_MODEL = getattr(settings, 'TAGGIT_AUTOSUGGEST_MODEL', ('taggit', 'Tag'))
 TAG_MODEL = get_model(*TAG_MODEL)
 def list_tags(request):
     Returns a list of JSON objects with a `name` and a `value` property that
     except ValueError:
         limit = MAX_SUGGESTIONS
-    tag_name_qs = TAG_MODEL.objects.filter(name__istartswith=query).\
+    tag_name_qs = TAG_MODEL.objects.filter(name__icontains=query).\
         values_list('name', flat=True)
     data = [{'name': n, 'value': n} for n in tag_name_qs[:limit]]