Reg. Basic django.db.models

2011-11-04 Thread Ganesh Kumar
Hi, I'm a new to Django. I know mysql queries. I cant understand django queries, Basically My understanding complicated to the django queries. please guide me. Device.objects.filter(device_id = device_id)[0] Device->table device-->column Device.objects.filter(locked = True) Device.objec

Re: Reg. Basic django.db.models

2011-11-04 Thread Brett Epps
Hi Ganesh, Here are some examples: Filter: SELECT * FROM device WHERE locked = true - returns a QuerySet which can be evaluated as a list of Device objects Get: SELECT * FROM device WHERE id = (value of id variable) LIMIT 1 - returns a single Device object All: SELECT * FROM schedule - returns a