I want a command for getting a query set from the model. The SQL command will be like
SELECT teamName FROM TABLE WHERE userName=userName;
CodePudding user response:
you can retrive list of field from model by using values_list
Model.Objects.filter(userName = userName).values_list('teamName')
CodePudding user response:
I found the answer
teamNameQuery=userInfo.objects.filter(userName=userName).values('teamName').first()