Re: Query with 3 models

2012-07-19 Thread Julio Galvez
That works awesome!!. I'm new in this, and I don't know many things about how works django. Thanks all for help me El jueves, 19 de julio de 2012 15:07:44 UTC-5, Tomas Neme escribió: > > > Thanks, the first example is exactly that i want. I try it in the Django > > Shell and it works, but; How

Re: Query with 3 models

2012-07-19 Thread Tomas Neme
> Thanks, the first example is exactly that i want. I try it in the Django > Shell and it works, but; How I show the results in the template? > > Maybe I'm wrong, but I try to pass like { 'empresas': > Empresa.objects.all().select_related() } ,and only can show the 'Empresa' > attributes on the lo

Re: Query with 3 models

2012-07-19 Thread Julio Galvez
Thanks, the first example is exactly that i want. I try it in the Django Shell and it works, but; How I show the results in the template? Maybe I'm wrong, but I try to pass like { 'empresas': Empresa.objects.all().select_related() } ,and only can show the 'Empresa' attributes on the loop. I

Re: Query with 3 models

2012-07-19 Thread Thomas Orozco
Shouldn't that be a prefetch related and not select related? Le 19 juil. 2012 16:52, "Tomas Neme" a écrit : > > > {Empresa1, Sucursal1, Platillo1, Horario1}, > > {Empresa1, Sucursal1, Platillo2, Horario1}, > > {Empresa2, Sucursal1, Platillo1, Horario1}... > > I'm guessing the Sucursal1 in the fir

Re: Query with 3 models

2012-07-19 Thread Python_Junkie
If you are comfortable with sql syntax, just pull the data you want with sql joins. You already have the keys set up On Thursday, July 19, 2012 5:16:42 AM UTC-4, Julio Galvez wrote: > > Hi, I'm new with Django and in this Groups; I have the next models and > question > > class Empresa(models.Mo

Re: Query with 3 models

2012-07-19 Thread Tomas Neme
> {Empresa1, Sucursal1, Platillo1, Horario1}, > {Empresa1, Sucursal1, Platillo2, Horario1}, > {Empresa2, Sucursal1, Platillo1, Horario1}... I'm guessing the Sucursal1 in the first and third lines are not the same? I mean, each Sucursal points to only one Empresa, so I'm guessing you want only the