﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26320	Deprecate implicit OneToOneField parent_link	Bertrand Bordage	nobody	"Suppose we have these models:
{{{#!python
class Parent(Model):
    pass

class Child(Parent):
    parent_ptr2 = OneToOneField(Parent, null=True, related_name='+')
}}}

`Child` should have two `OneToOneField`s, `parent_ptr` and `parent_ptr2`.
Unfortunately, Django has a critical issue where it merges these two fields into this:
{{{#!python
parent_ptr2 = OneToOneField(Parent, primary_key=True, null=True, related_name='+')
}}}
And of course, a nullable primary key is impossible, so we can’t even do a migration: `fields.E007` is raised.
But defining without multi-table inheritance exactly the same model – in terms of database definition – works just fine:
{{{#!python
class WorkingModel(Model):
    parent_ptr = OneToOneField(Parent, primary_key=True, related_name='+')
    parent_ptr2 = OneToOneField(Parent, null=True, related_name='+')
}}}
So multi-table inheritance is probably what causes this confusion.
This bug is present on all supported Django versions, from 1.8 to 1.9.3.

I guess this can be seen as a release blocker, there is no regression but this is quite critical (and blocking, in my case)."	Cleanup/optimization	closed	Database layer (models, ORM)	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
