Re: query join tables

2014-10-13 Thread Jani Tiainen
On Sun, 12 Oct 2014 22:01:51 -0700 (PDT) dk wrote: > I have this 2 models > > class Choice(models.Model): > restaurant = models.ForeignKey(Restaurant) > person = models.ForeignKey(Person) > date = models.DateField("time published") > time =

Re: query join tables

2014-10-13 Thread Anderson
HI there.. Looks like you already have the person ID , you don't need hit the database every time to call Person object. You can make faster only check for ID not Person object. instead this: person = Person.objects.get(name=person_name) choices_for_person_on_date =

Re: query join tables

2014-10-13 Thread dk
I will give a try, how does django know that have to join using double filter? or it just auto-magically knows behind the hood? or filtering by another model/class django get the idea, and joins the tables? Thanks Tom =) -- You received this message because you are subscribed to the Google

Re: query join tables

2014-10-12 Thread Tom Lockhart
On Oct 12, 2014, at 10:01 PM, dk wrote: > I have this 2 models > > class Choice(models.Model): > restaurant = models.ForeignKey(Restaurant) > person = models.ForeignKey(Person) > date = models.DateField("time published") > time = models.TimeField("date

query join tables

2014-10-12 Thread dk
I have this 2 models class Choice(models.Model): restaurant = models.ForeignKey(Restaurant) person = models.ForeignKey(Person) date = models.DateField("time published") time = models.TimeField("date published") class Person(models.Model): name =