Пример #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
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")