hi
i am quite confused between get() function and filter() function, what is the difference between. it seems they all retrieve the specific row from database.
i have written this code in one function of my application and it works:
[code=python]
Rt=outlet.objec ts.get(id__exac t=return_locati on)
r=Rt.outlet_nam e
[/code]
in my other functions, i write this and it also works:
[code=python]
allObj =Booking1.objec ts.filter(id = booking)
[/code]
in the other scenario, which i use filter it will work but when i change it into get,it complain about errors. which the code is like the following:
[code=python]
my = Booking1.object s.filter(id__ex act= myId)
my.delete()
[/code]
thus i am very confused about how it works and what is the difference between get() and filter()
(PS, i am using Django framework which is build on python programming language)
this problem is a bit urgent at the moment,as it causes a lot of problem for me and my project is running out of time. thanks in advance for any kind help :)
i am quite confused between get() function and filter() function, what is the difference between. it seems they all retrieve the specific row from database.
i have written this code in one function of my application and it works:
[code=python]
Rt=outlet.objec ts.get(id__exac t=return_locati on)
r=Rt.outlet_nam e
[/code]
in my other functions, i write this and it also works:
[code=python]
allObj =Booking1.objec ts.filter(id = booking)
[/code]
in the other scenario, which i use filter it will work but when i change it into get,it complain about errors. which the code is like the following:
[code=python]
my = Booking1.object s.filter(id__ex act= myId)
my.delete()
[/code]
thus i am very confused about how it works and what is the difference between get() and filter()
(PS, i am using Django framework which is build on python programming language)
this problem is a bit urgent at the moment,as it causes a lot of problem for me and my project is running out of time. thanks in advance for any kind help :)
Comment