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 = models.CharField(max_length=100
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 published")
>
> class Pers
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
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 =
Choice.objects.filter(date=d
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 = models.TimeField("date published")
>
>
5 matches
Mail list logo