예제 #1
0
def all_tag_search(request):
    term = request.GET['term']
    tags = []
    qset = TaggedItem.tags_for(Community).filter(name__istartswith=term)
    tags += [t.name for t in qset]
    qset = TaggedItem.tags_for(Need).filter(name__istartswith=term)
    tags += [t.name for t in qset]
    qset = TaggedItem.tags_for(Resource).filter(name__istartswith=term)
    tags += [t.name for t in qset]
    qset = TaggedItem.tags_for(Organization).filter(name__istartswith=term)
    tags += [t.name for t in qset]
    tags = list(set(tags))  # remove duplicates
    return HttpResponse(to_json(tags), mimetype="application/x-javascript")
예제 #2
0
def all_tag_search(request):
    term = request.GET['term']
    tags = []
    qset = TaggedItem.tags_for(Community).filter(name__istartswith=term)
    tags += [t.name for t in qset]
    qset = TaggedItem.tags_for(Need).filter(name__istartswith=term)
    tags += [t.name for t in qset]
    qset = TaggedItem.tags_for(Resource).filter(name__istartswith=term)
    tags += [t.name for t in qset]
    qset = TaggedItem.tags_for(Organization).filter(name__istartswith=term)
    tags += [t.name for t in qset]
    tags = list(set(tags))  # remove duplicates
    return HttpResponse(to_json(tags),
                mimetype="application/x-javascript")
예제 #3
0
def tag_search(request):
    term = request.GET['term']
    qset = TaggedItem.tags_for(Project).filter(name__istartswith=term)
    # qset = TaggedItem.tags_for(project)
    tags = [t.name for t in qset]
    return HttpResponse(simplejson.dumps(tags),
                mimetype="application/x-javascript")
예제 #4
0
def search_tags(request):
    term = request.GET['term']
    qset = TaggedItem.tags_for(Proposal).filter(
        name__istartswith=term).annotate(
            count=Count('taggit_taggeditem_items__id')).order_by(
                '-count', 'slug')[:10]
    tags = [t.name for t in qset]
    return HttpResponse(to_json(tags), mimetype="application/x-javascript")
예제 #5
0
def search_tags(request):
    term = request.GET['term']
    qset = TaggedItem.tags_for(Proposal).filter(name__istartswith=term
            ).annotate(count=Count('taggit_taggeditem_items__id')
            ).order_by('-count', 'slug')[:10]
    tags = [t.name for t in qset]
    return HttpResponse(to_json(tags),
                mimetype="application/x-javascript")
예제 #6
0
파일: views.py 프로젝트: it3s/mootiro-maps
def search_tags(request):
    term = request.GET["term"]
    qset = (
        TaggedItem.tags_for(Resource)
        .filter(name__istartswith=term)
        .annotate(count=Count("taggit_taggeditem_items__id"))
        .order_by("-count", "slug")[:10]
    )
    tags = [t.name for t in qset]
    return HttpResponse(to_json(tags), mimetype="application/x-javascript")
예제 #7
0
def tag_search(request):
    term = request.GET['term']
    qset = TaggedItem.tags_for(Need).filter(name__istartswith=term)
    tags = [t.name for t in qset]
    return HttpResponse(to_json(tags),
                mimetype="application/x-javascript")
예제 #8
0
def tag_search(request):
    term = request.GET['term']
    qset = TaggedItem.tags_for(Project).filter(name__istartswith=term)
    tags = [t.name for t in qset]
    return HttpResponse(to_json(tags), mimetype="application/x-javascript")