def get_vits(request):
    user = KeyBackend().authenticate(request)
    if request.user.is_authenticated:
        vits = Vit.objects.filter(((Q(user=request.user) | Q(user__profile__in=request.user.profile.follows.all())) | Q(user__profile__in=request.user.profile.followed_by.all()))).order_by('-date')
        return JsonResponse({'vits': [vit.to_json() for vit in vits]})
    else:
        return JsonResponse({'error': 'You must be logged in'}, status=401)
def get_vits(request):
    user = KeyBackend().authenticate(request)
    if request.user.is_authenticated:
        vits = Vit.objects.filter(((Q(user=request.user) | Q(user__profile__in=request.user.profile.follows.all())) | Q(user__profile__in=request.user.profile.followed_by.all()))).order_by('-date')
        return JsonResponse({'vits': [vit.to_json() for vit in vits]})
    else:
        return JsonResponse({'error': 'You must be logged in'}, status=401)