def user_json(request, name=None): if name: q = User.objects.filter(name__istartswith=name).order_by('username') else: q = User.objects.all().order_by('username') data = json_encode(q, only=['username']) return HttpResponse(data, mimetype="text/plain")
def item_json(request, name=None): if name: q = DownloadItem.objects.filter(name__istartswith=name).order_by('group') else: q = DownloadItem.objects.all().order_by('group') data = json_encode(q, only=['name']) return HttpResponse(data, mimetype="text/plain")