﻿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
29806	Add parent_link to ForeignKey	Victor Porton	nobody	"I propose to allow `parent_link` argument to `ForeignKey`.

This would mean that a model is derived from another model, but instead of `OneToOneField` we use `ForeignKey` what means that several instances of the derived model may share the same instance of the parent model.

Let

{{{
class A(models.Model):
    x = models.IntegerField()

class B(A):
    parent = ForeignKey(A, parent_link=True)
    y = models.IntegerField()
}}}

The rationale is the same as for existing model inheritance: I want to shorten code: Instead of `b.parent.x` write just `b.x`.

I see no other reason whatsoever (except that it a little complicates the understanding as every new feature does) to deny my feature. If it is done for `OneToOneField` why not to do the same for `ForeignKey`? There are no differences of arguments pro an contra for `ForeignKey` and for `OneToOneField`. Thus if this works for `OneToOneField` it should also be done for `ForeignKey`.

Also note that this new feature is useful for DB normalization: When the models structure changes, separating a parent object into a separate model, this feature would allow not to add `.parent.` every time `x` is used."	New feature	closed	Database layer (models, ORM)	2.1	Normal	duplicate			Unreviewed	0	0	0	0	0	0
