from django.conf import settings
from django.http import HttpResponse
from django.utils import simplejson as json
from taggit.models import Tag


MAX_SUGGESTIONS = getattr(settings, 'TAGGIT_AUTOSUGGEST_MAX_SUGGESTIONS', 20)


def list_tags(request):
    """
    Returns a list of JSON objects with a `name` and a `value` property that
    all start like your query string `q` (not case sensitive).
    """
    query = request.GET.get('q', '')
    limit = request.GET.get('limit', MAX_SUGGESTIONS)
    try:
        request.GET.get('limit', MAX_SUGGESTIONS)
        limit = min(int(limit), MAX_SUGGESTIONS)  # max or less
    except ValueError:
        limit = MAX_SUGGESTIONS

    tag_name_qs = Tag.objects.filter(name__istartswith=query).\
        values_list('name', flat=True)
    data = [{'name': n, 'value': n} for n in tag_name_qs[:limit]]

    return HttpResponse(json.dumps(data), mimetype='application/json')


def list_all_tags(request):
    """Returns all the tags in the database"""
    all_tags = Tag.objects.all().values_list('name', flat=True)
    return HttpResponse(json.dumps(list(all_tags)), mimetype='application/json')

@@ -67,46 +67,14 @@
 nse%0A
-from django.utils import simplejson as
+import
  jso

Remove deprecated django json shim