#7623: Multi-table inheritance does not allow linking new instance of child model to existing parent model instance. -------------------------------------+------------------------------------- Reporter: brooks.travis@… | Owner: nobody Type: Bug | Status: reopened Component: Database layer | Version: SVN (models, ORM) | Resolution: Severity: Normal | Triage Stage: Design Keywords: model-inheritance, | decision needed multi-table-inheritance | Needs documentation: 1 Has patch: 1 | Patch needs improvement: 1 Needs tests: 1 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+------------------------------------- Changes (by Nan):
* status: closed => reopened * resolution: needsinfo => Comment: Here's a more reasonable example... {{{ # models.py 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() }}} Now, say we have a bunch of Place objects in the database, and a form where users can inform us what sort of business a particular Place is (OK, this is a contrived example, but I'm sure you can see that this could be a reasonable use case for some types of data). {{{ # somewhere in views.py p = Place.objects.get(pk=1) restaurant = Restaurant(**{ 'place': p, 'serves_hot_dogs': False, 'serves_pizza': True, }) restaurant.save() }}} -- Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:13> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.