Beispiel #1
0
def get_recommended_tags_view_new(request):
    if request.is_ajax() and request.method == 'POST':
        input_tags = request.POST.get('input_tags', False)
        category = request.POST.get('category', False)
        if category:
            result = NewTagRecommendation.recommend_tags_category(input_tags, category)
        else:
            result = NewTagRecommendation.recommend_tags(input_tags)
        return HttpResponse(json.dumps(result), content_type='application/javascript')

    return HttpResponse(json.dumps({'tags':[], 'audio_category':None}), content_type='application/javascript')
Beispiel #2
0
def get_recommended_tags_view_new(request):
    if request.is_ajax() and request.method == 'POST':
        input_tags = request.POST.get('input_tags', False)
        category = request.POST.get('category', False)
        if category:
            result = NewTagRecommendation.recommend_tags_category(input_tags, category)
        else:
            result = NewTagRecommendation.recommend_tags(input_tags)
        return HttpResponse(json.dumps(result), content_type='application/javascript')

    return HttpResponse(json.dumps({'tags':[], 'audio_category':None}), content_type='application/javascript')
Beispiel #3
0
def get_all_categories_view(request):
    if request.is_ajax() and request.method == 'POST':
        result = NewTagRecommendation.all_tag_categories()
        categories = [str(category) for category in result['categories']]
        return HttpResponse(json.dumps(categories), content_type='application/javascript')

    return HttpResponse(json.dumps([]), content_type='application/javascript')
Beispiel #4
0
def get_all_categories_view(request):
    if request.is_ajax() and request.method == 'POST':
        result = NewTagRecommendation.all_tag_categories()
        categories = [str(category) for category in result['categories']]
        return HttpResponse(json.dumps(categories), content_type='application/javascript')

    return HttpResponse(json.dumps([]), content_type='application/javascript')
Beispiel #5
0
def get_recommended_categories_view(request):
    if request.is_ajax() and request.method == 'POST':
        input_tags = request.POST.get('input_tags', False)
        result = NewTagRecommendation.recommend_categories(input_tags)
        categories = [str(category) for category in result['categories']]
        return HttpResponse(json.dumps(categories), content_type='application/javascript')

    return HttpResponse(json.dumps([]), content_type='application/javascript')
Beispiel #6
0
def get_recommended_categories_view(request):
    if request.is_ajax() and request.method == 'POST':
        input_tags = request.POST.get('input_tags', False)
        result = NewTagRecommendation.recommend_categories(input_tags)
        categories = [str(category) for category in result['categories']]
        return HttpResponse(json.dumps(categories), content_type='application/javascript')

    return HttpResponse(json.dumps([]), content_type='application/javascript')