Re: Django Dying upon loop

2014-06-21 Thread Jangita Nyagudi
Can you post the two models? Are they related? You'd rather loop in the template in my opinion... On 20 Jun 2014 02:17, "G Z" wrote: > my django server dies whenever i login and access the following function: > > what is a better way to do what im doing. I need to loop through all of > the vm_gro

Re: Django Dying upon loop

2014-06-20 Thread George Silva
You can use the raw() function to create a adhoc query to the database. Check the documentation and write proper sql code. It will be much more efficient. On Fri, Jun 20, 2014 at 12:44 PM, G Z wrote: > There instead of looping through the queries i do it all in one loop but > its still taking f

Re: Django Dying upon loop

2014-06-20 Thread G Z
shouldn't this work? After doing some more research into making django queries faster and more efficient I came across, http://tech.yipit.com/2013/01/20/making-django-orm-queries-faster/ I'm using thier method from what I understand you can selec_related to a primary key field and query like suc

Re: Django Dying upon loop

2014-06-20 Thread G Z
There instead of looping through the queries i do it all in one loop but its still taking forever, how does django do the query, it seems like its doing a Cartesian product ? My server dies when ever I hit this page. query_results = Customer.objects.all() customers = {} data = {} cus

Re: Django Dying upon loop

2014-06-20 Thread G Z
Sad part is I can do it in python well, I just can't seem to grasp the way django works i keep reading the damn documentation but I cant see any good examples relating to what I have to do. On Friday, June 20, 2014 5:10:10 AM UTC-6, Tom Evans wrote: > > On Fri, Jun 20, 2014 at 12:16 AM, G Z > >

Re: Django Dying upon loop

2014-06-20 Thread Tom Evans
On Fri, Jun 20, 2014 at 12:16 AM, G Z wrote: > my django server dies whenever i login and access the following function: > > what is a better way to do what im doing. I need to loop through all of the > vm_groups by customer id, and then loop through all of the vms and associate > them with each o

Django Dying upon loop

2014-06-19 Thread G Z
my django server dies whenever i login and access the following function: what is a better way to do what im doing. I need to loop through all of the vm_groups by customer id, and then loop through all of the vms and associate them with each other. The code below is what i have but its not worki