Convert MySQL to django model object | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Convert MySQL to django model object

MySQL>>Select mobile from student where name=ravan MyModel.objects............??

7th May 2021, 12:01 PM
Naga Raju K
4 Answers
0
Mymodel.objects.filter(name='ravan')
7th May 2021, 12:51 PM
Alpha Diallo
Alpha Diallo - avatar
0
I want mobile value
7th May 2021, 1:09 PM
Naga Raju K
0
To get that just iterate over the response provided by filter an access the mobile field
7th May 2021, 2:18 PM
Alpha Diallo
Alpha Diallo - avatar
0
I got the resui Mymodel.objects.filter(name='ravan')[0].mobile
7th May 2021, 3:02 PM
Naga Raju K