path('api/list_projects/<int:user_id>', ProjectsView.as_view())
class ProjectsView(View):
def get(self):
user = self.kwargs["user_id"]
user_account = UserAccount.objects.get(user=user)
customer = Customer.objects.get(useraccount=user_account)
projects = Project.objects.filter(customer=customer)
return JsonResponse(projects, safe=False)