﻿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
26703	field automatically choosen as primary_key (primary_key=False do not work)	Nicolas BREMOND	nobody	"I tried to use multi-table inheritance with a OneToOne field to the parent class in the child class but this field seems to be detected as primary_key by Django (there is only one row in the database).

The field has the same type as the parent link automatically created by Django and 
the [https://docs.djangoproject.com/en/1.10/topics/db/models/#specifying-the-parent-link-field doc on inheritance] tells that we can choose to use a such field for the inheritance relation with `parent_link=True` but I need the inheritance relation AND my other relation.
I tried to add `parent_link=False` but this don't change anything.
If I add `null=True` I got an error :
{{{
SystemCheckError: System check identified some issues:

ERRORS:
testapp.A.other: (fields.E007) Primary keys must not have null=True.
	HINT: Set null=False on the field, or remove primary_key=True argument.
from django.db import models
}}}
So I tried to add `primary_key=False` but that don't change anything.

There is a minimal code wich reproduce the error

models.py :
{{{
#!python
class Base(models.Model):
    pass

class A(Base):
    other=models.OneToOneField(Base,
            parent_link=False,#do not change anything
            primary_key=False,#do not change anything
            null=True,#raise a SystemCheckError
            related_name='other_base',
            )

}}}

I can continue my project if I replace the `OneToOneField` by a `ForeignKey` with `unique=True` but I have a warning with a hint to replace the `ForeignKey` by a `OneToOneField` :
{{{
System check identified some issues:

WARNINGS:
testapp.A.other: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
	HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
}}}"	Bug	closed	Database layer (models, ORM)	1.9	Normal	duplicate	multi-table inheritance, primary_key, OneToOneField		Unreviewed	0	0	0	0	0	0
