That works great...thanks
bruno desthuilliers wrote:
> On 29 oct, 23:49, Andew Gee <gee.webm...@gmail.com> wrote:
> > Hi,
> >
> > I have the following models
> >
> > class Person(models.Model):
> > name = models.CharField(max_length=100)
> >
> > class Employee(Person):
> > job = model.Charfield(max_length=200)
> >
> > class PhoneNumber(models.Model):
> > person = models.ForeignKey(Person)
> >
> > How do I access the PhoneNumbers associated with an employee if I have
> > the employee id?
> >
> > Currently I am using
> >
> > phones = PhoneNumbers.objects.filter(person__id=employee.id)
> >
>
> In that case you not only have the employee id, you do have the whole
> employee instance, so you can just use employee.phonenumber_set.all()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---