def get_vit(request, id):
    user = KeyBackend().authenticate(request)
    if request.user.is_authenticated:
        try:
            vit = Vit.objects.get(id=id)
            return JsonResponse({'vit': vit.to_json()}, status=200)
        except:
            return JsonResponse({'error': 'Vit not found'}, status=404)
    else:
        return JsonResponse({'error': 'You must be logged in'}, status=401)
def get_vit(request, id):
    user = KeyBackend().authenticate(request)
    if request.user.is_authenticated:
        try:
            vit = Vit.objects.get(id=id)
            return JsonResponse({'vit': vit.to_json()}, status=200)
        except:
            return JsonResponse({'error': 'Vit not found'}, status=404)
    else:
        return JsonResponse({'error': 'You must be logged in'}, status=401)