+def matching_tags(request):
+ if len(request.GET['q']) == 0:
+ raise Exception(_("Invalid request"))
+
+ possible_tags = Tag.objects.filter(name__istartswith = request.GET['q'])
+ tag_output = ''
+ for tag in possible_tags:
+ tag_output += (tag.name + "|" + tag.name + "." + tag.used_count.__str__() + "\n")
+
+ return HttpResponse(tag_output, mimetype="text/plain")
+