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)

and it works only because I know that the employee.id and person.id
are the same value, but I am sure this is the incorrect way to do
it.

Thanks
Andrew
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to