r = Restaurant(place=p1, serves_hot_dogs=True, serves_pizza=False)and the attached note says:
Pass the ID of the "parent" object as this object's ID.Are you sure that the place ID is, in fact, what is being transferred?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
Hello,
I was just going through this posting and I noticed that you are using concrete inheritance in your calling of |
class Place(models.Model):
name = models.CharField(max_length=50)
address = models.CharField(max_length=80) class Restaurant(Place):
place = models.OneToOneField(Place, parent_link=True, related_name='restaurant') serves_hot_dogs = models.BooleanField() serves_pizza = models.BooleanField() |
Try |
class Place(models.Model):
name = models.CharField(max_length=50)
address = models.CharField(max_length=80) |
class Meta:
abstract = True |
class Restaurant(Place):
place = models.OneToOneField(Place, parent_link=True, related_name='restaurant') serves_hot_dogs = models.BooleanField() serves_pizza = models.BooleanField() |
This is abstract inheritance and any model inheriting Place will get a copy of Place's fields onto the child object instead of getting another Table placed there.
Michael
|
|
|
|
|
|
|
|
http://lino.saffre-rumma.net/autodoc/lino.test_apps.1.html
Looking forward to any comments.
Luc