Django object / Sql problem
I am just beginning to use Django, and I am ha开发者_如何学运维ving problems.
I would like to translate the following SQL:
SELECT id FROM modelName WHERE email=request.form['email']
into Django object code
uid = modelName.objects.(whatever goes in here)
Thanks in advance
The SQL query returns a list of id
. Here is the Django version:
list_id = modelClass.objects.filter(email=request.form['email']).values_list('id', flat=True)
精彩评论