Commits

George Notaras committed f757ea2

Use the Tag model defined in the settings for tag list retrieval.

Comments (0)

Files changed (1)

src/taggit_autocomplete_modified/views.py

 from django.http import HttpResponse
 from django.utils.datastructures import MultiValueDictKeyError
 
+from taggit_autocomplete_modified import settings
+
 
 def list_tags(request):
-    Tag = cache.get_model('tagging', 'Tag')
+    app_label, model_class = settings.TAGGIT_AUTOCOMPLETE_TAG_MODEL.split('.')
+    Tag = cache.get_model(app_label, model_class)
     try:
         tags = Tag.objects.filter(name__istartswith=request.GET['q']).values_list('name', flat=True)
     except MultiValueDictKeyError:
-        pass
+        tags = []
     return HttpResponse('\n'.join(tags), mimetype='text/plain')
 
-