Re: Newbie Django queryset question

2012-03-15 Thread Shawn Milochik
On 03/15/2012 11:22 PM, Murilo Vicentini wrote: Uhmmm, thank you a lot. That was what I was looking for! Sorry for wasting your time. One last question, does this double-underscore notation work at my html template? Because after filtering I will want to display the information of the

Re: Newbie Django queryset question

2012-03-15 Thread Murilo Vicentini
Uhmmm, thank you a lot. That was what I was looking for! Sorry for wasting your time. One last question, does this double-underscore notation work at my html template? Because after filtering I will want to display the information of the different models at one row of my table. On Friday,

Re: Newbie Django queryset question

2012-03-15 Thread Shawn Milochik
You can certainly use Q objects to query across models, just as you can in a normal QuerySet, by using the double-underscore notation. https://docs.djangoproject.com/en/1.3/topics/db/queries/#lookups-that-span-relationships -- You received this message because you are subscribed to the Google

Re: Newbie Django queryset question

2012-03-15 Thread Murilo Vicentini
But if I got it correctly I can use Q objects to make complex filters but they only apply to one model, what I need is a combination of the models. And since the search can return more than one (or even zero) objects I can't use get() to see the related objects. On Thursday, March 15, 2012

Re: Newbie Django queryset question

2012-03-15 Thread Shawn Milochik
If you don't know which fields your users will be searching on in advance, you'll have to create Q objects and dynamically build your query in your view. https://docs.djangoproject.com/en/1.3/topics/db/queries/#complex-lookups-with-q-objects -- You received this message because you are

Newbie Django queryset question

2012-03-15 Thread Murilo Vicentini
Hey guys, sorry if this is a newbie question, but I'm new at django and I'm having a real hard time trying to figure out how to solve this. So I have this model. class Run(models.Model): speccpus = models.ForeignKey('Speccpu') hosts = models.ForeignKey('Host') Task =