@csrf_exempt
def add_vit(request):
    '\n    Add a new vit with API, currently image and video are not supported\n    '
    user = KeyBackend().authenticate(request)
    if (request.method == 'POST'):
        if request.user.is_authenticated:
            form = VitForm(request.POST)
            if form.is_valid():
                vit = form.save(commit=False)
                vit.user = request.user
                vit.save()
                return JsonResponse({'status': 'success', 'vit': vit.to_json()}, status=201)
            else:
                return JsonResponse({'error': 'No vit body provided'}, status=400)
        else:
            return JsonResponse({'error': 'You must be logged in'}, status=401)
    else:
        return JsonResponse({'error': 'Invalid request'}, status=400)
Add a new vit with API, currently image and video are not supported
@csrf_exempt
def add_vit(request):
    '\n    \n    '
    user = KeyBackend().authenticate(request)
    if (request.method == 'POST'):
        if request.user.is_authenticated:
            form = VitForm(request.POST)
            if form.is_valid():
                vit = form.save(commit=False)
                vit.user = request.user
                vit.save()
                return JsonResponse({'status': 'success', 'vit': vit.to_json()}, status=201)
            else:
                return JsonResponse({'error': 'No vit body provided'}, status=400)
        else:
            return JsonResponse({'error': 'You must be logged in'}, status=401)
    else:
        return JsonResponse({'error': 'Invalid request'}, status=400)