Exemplo n.º 1
0
def get_suggestions_client(request):
    page = int(request.GET.get('page', 0))
    type_ = request.GET.get('type', 'rated')
    user = _validate_token(request)
    results = []
    if user:
        if type_ == 'rated':
            results = shows.get_most_rated_shows(user, page, 6)
        else:
            results = shows.get_most_viewed_shows(user, page, 6)

    data = simplejson.dumps(results)
    return HttpResponse(data, mimetype='application/json')
Exemplo n.º 2
0
def get_suggestions_client(request):
    page = int(request.GET.get('page', 0))
    type_ = request.GET.get('type', 'rated')
    user = _validate_token(request)
    results = []
    if user:
        if type_ == 'rated':
            results = shows.get_most_rated_shows(user, page, 6)
        else:
            results = shows.get_most_viewed_shows(user, page, 6)

    data = simplejson.dumps(results)
    return HttpResponse(data, mimetype='application/json')
Exemplo n.º 3
0
def get_suggestions(request):
    page = int(request.GET.get('page', 0))
    type_ = request.GET.get('type', 'rated')
    response = {}
    if request.user.is_anonymous():
        user = None
    else:
        user = request.user
    if type_ == 'rated':
        results = shows.get_most_rated_shows(user, page)
    else:
        results = shows.get_most_viewed_shows(user, page)

    response['suggestion'] = results
    data = simplejson.dumps(response)

    return HttpResponse(data, mimetype='application/json')
Exemplo n.º 4
0
def get_suggestions(request):
    page = int(request.GET.get('page', 0))
    type_ = request.GET.get('type', 'rated')
    response = {}
    if request.user.is_anonymous():
        user = None
    else:
        user = request.user
    if type_ == 'rated':
        results = shows.get_most_rated_shows(user, page)
    else:
        results = shows.get_most_viewed_shows(user, page)

    response['suggestion'] = results
    data = simplejson.dumps(response)

    return HttpResponse(data, mimetype='application/json')