{{{
class Person(models.Model):
some_field...
...
class Doctor(Person):
doctor_field...
...
my_doctor = Doctor.objects.create(...)
}}}
Running manage dumpdata will cause the export to be broken. The
"my_doctor" instance will be exported without the pointer to the person-
object it will models will be within the export, but without the linking
pointer value. (Probably called something like person_ptr) However if
--natural-primary is included, the key will be there.
However, regardless of method the needed linked data within the person
table is omitted, so running import data on a site with subclassed models
like this will ''never'' work.
This bug seems to be present in 3.0 and onward.
--
Ticket URL: <https://code.djangoproject.com/ticket/33510>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => invalid
Comment:
Thanks for the report.
> However, regardless of method the needed linked data within the person
table is omitted, so running import data on a site with subclassed models
like this will never work.
Have you tried to import dumped data? It works for me in both cases, i.e.
with and without using `--natural-primary`. `person_ptr` is unnecessary
because it's a `OneToOneField()` which is also a `Doctor`'s primary key,
see [https://docs.djangoproject.com/en/4.0/topics/db/models/#multi-table-
inheritance docs].
--
Ticket URL: <https://code.djangoproject.com/ticket/33510#comment:1>
Comment (by Robin Harms Oredsson):
Hi, sorry about this. You're right - the reason I have this problem is
that the superclass has a custom manager that causes polymorphic
behaviour, so the 1-1 relation becomes corrupt. So not a problem with
Django.
I thought those custom managers were disabled during exporting though?
--
Ticket URL: <https://code.djangoproject.com/ticket/33510#comment:2>