@login_required
def add_vote(request, suggestion_id):
    suggestion = Suggestion.objects.get(pk=suggestion_id)
    did_vote = suggestion.rating.get_rating_for_user(request.user, request.META['REMOTE_ADDR'])
    if did_vote == None:
        suggestion.rating.add(score=1, user=request.user, ip_address=request.META['REMOTE_ADDR'])
    return HttpResponseRedirect('../../')
dataset/ETHPy150Open azavea/Open-Data-Catalog/OpenDataCatalog/suggestions/views.py/add_vote/original