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" <[email protected]> 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 other.
> The code below is what i have but its not working. django just kills its
> self.
>
> def portal(request):
>
> query_results = Customer.objects.all()
>
> for result in query_results:
> customer_id = Customer.objects.values('customer_id')
>
> vm_group = Vm_group.objects.filter(customer=customer_id)
>
> for result in vm_group:
> vm_group_ids = Vm_group.objects.values('vm_group_id')
>
> for result in vm_group_ids:
> vms = Vm.objects.filter(vm_group_id=vm_group_ids)
>
>
> context = Context({'customer': query_results, 'vm_group': vm_group,
> 'vms': vms,
> })
>
> return render(request, 'portal.html', context)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/84cc69c3-b925-4bfb-b321-5918b5030c6e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/84cc69c3-b925-4bfb-b321-5918b5030c6e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CA%2BC-RFEnLQA7WRJsxbpxf2pTG0XA3CGwy87jd_Z3ydrOv%3DTtjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.