REST Django - filter with multiple variables
I know you can do something like :
if Test.objects.filter(id = 2).exists():
#do something
But with my attempt of using two variables, it does not work properly. I have a table with two Foreign keys to a User and a Project. I want to see if a specific combination exists. This attempt is what I tried but does not work.
if Test.objects.filter(user = User, project = Project).exists():
#do something
Maybe I just implemented it wrong ? my whole line is this. I get username and projectid by POST in the request.data
if Userproject.objects.filter(user= User.objects.get(username = request.data.get('username',0), project = Project.objects.get(id = request.data.get('projectid',0)).exists():