def cancel_request(request): if request.method == 'POST': request_id = request.POST['request_id'] if delete_item(request_id): return ok_resp return bad_resp return HttpResponseNotAllowed(['POST'])
def fulfill_request(request): if request.method == 'POST': request_id = request.POST['request_id'] if not delete_item(request_id): return bad_resp return_url = YELP_LOVE_URL if 'delivery_person' in request.POST: delivery_person = request.POST['delivery_person'] return_url += '?recipient=%s' % delivery_person return HttpResponse(json.dumps({'url': return_url})) return HttpResponseNotAllowed(['POST'])