On Thu, Jun 18, 2009 at 7:00 AM, Luc Saffre<luc.saf...@gmx.net> wrote:
>
> sandbox.contacts.models
> -----------------------
>
> from django.db import models
> class Contact(models.Model):
>    first_name = models.CharField(max_length=200)
> [...]
> class Customer(contacts.Contact):
>    payment_term = models.IntegerField(blank=True,null=True)
>
>
> My problem
> ----------
>
> When I test this by running "python manage.py test sales", then I get:
>
>  Failed example:
>      c = Customer(contact=luc)
>  Exception raised:
>      (...)
>      TypeError: 'contact' is an invalid keyword argument for this
>      function
>
> I noticed that the child class "Customer" has indeed no OneToOneField
> named "contact". I guess it has to do with the parent and child class
> being in different applications.

Why do you thing there should be a automatically created one to one
relationship from Customer to Contact named "contact"?.

Read the MTI and OneToOneField documentation:

http://docs.djangoproject.com/en/dev/ref/models/fields/#onetoonefield
http://docs.djangoproject.com/en/dev/topics/db/models/#id7

regarding the parent link field and how to make that relationship
explicit and control its name.

Regards,

-- 
Ramiro Morales
http://rmorales.net

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