Opened 3 weeks ago

Last modified 2 weeks ago

#35956 new New feature

Add composite foreign keys

Reported by: Csirmaz Bendegúz Owned by:
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Csirmaz Bendegúz Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This is a follow up to #373 (CompositePrimaryKey).

Now that composite primary keys are merged, it would be great to be able to create foreign keys referencing them through the Django ORM.

My proposal is to add 2 parameters to ForeignKey: from_fields and to_fields.
They would map to the underlying ForeignObject's from_fields, to_fields parameters.

If a ForeignKey has multiple fields, it acts as a virtual field, meaning it doesn't create a database column automatically.

Change History (1)

comment:1 by Sarah Boyce, 2 weeks ago

Triage Stage: UnreviewedAccepted
Note: See TracTickets for help on using tickets.
Back to Top