﻿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
28824	Allow different Foreign Keys to share same underlying DB column	klass-ivan	nobody	"{{{
class A(Model):
    uid = CharField(unique=True)
    # other fields

class B(Model):
    uid = CharField(unique=True)
    # other fields

class C(Model):
   # other fields
   uid  = CharField(unique=False)
   a = ForeignKey(to=A, to_field='uid', db_column='uid', null=True)
   b = ForeignKey(to=B, to_field='uid', db_column='uid', null=True)
}}}

Gives an error:

{{{
Field 'b' has column name 'uid' that is used by another field.
	HINT: Specify a 'db_column' for the field.
}}}

However, ForeignKey field is a ORM relation based on underlying column anyway.
I think it won't break anything if we allow different foreign keys to share same underlying column.
This adds more flexibility and will allow better django ""on-boarding"" process for legacy projects.
It will be also useful when A or B is proxy model - so we can get different proxy objects by different foreign keys referencing same DB row.

Another example can be found here:
[https://stackoverflow.com/questions/36911804/django-use-same-column-for-two-foreign-keys]
"	New feature	closed	Database layer (models, ORM)	1.11	Normal	wontfix	foreigh key, db_column,		Unreviewed	0	0	0	0	0	0
