Пример #1
0
def update_tour_status(request):
    """Update User tour status."""
    form = UserTourStatusForm(request.POST, instance=request.user.profile,)

    if not form.is_valid():
        return JsonResponse(
            {"status": False, "message": f"Bad Request: {form.errors}"}, status=400,
        )

    form.save()

    return JsonResponse({"status": True})
def update_tour_status(request):
    """Update User tour status."""
    form = UserTourStatusForm(
        request.POST,
        instance=request.user.profile,
    )

    if not form.is_valid():
        return HttpResponseBadRequest(form.errors.as_json())

    form.save()

    return HttpResponse('ok')
Пример #3
0
def update_tour_status(request):
    """Update User tour status."""
    form = UserTourStatusForm(
        request.POST,
        instance=request.user.profile,
    )

    if not form.is_valid():
        return JsonResponse(
            {
                'status': False,
                'message': 'Bad Request: {error}'.format(error=form.errors),
            },
            status=400)

    form.save()

    return JsonResponse({
        'status': True,
    })