Opened 7 years ago

Closed 7 years ago

#16119 closed New feature (invalid)

ForeignKey.on_delete emulated only

Reported by: mischiew@… Owned by: nobody
Component: Database layer (models, ORM) Version: 1.3
Severity: Normal Keywords: foreign key, on delete
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The on_delete property of ForeignKey is only emulated by Django, which means it is not implemented as a database definition. This has drawbacks:

  • prevents from using certain modes (especially RESTRICT)
  • makes it dangerous when the database is accessed by another client than Django (why should it be restricted?)

There should be at least an option to remove the emulation and use the normal database support when available (which is the most frequent scenario).

On the same not, on_update would be nice to have.
Likewise for ManyToManyField, support for on_delete and on_update would be nice.

Change History (1)

comment:1 Changed 7 years ago by Karen Tracey

Resolution: invalid
Status: newclosed

This sounds like a dupe of #7539, which was implemented for 1.3, see: and

Yet the version here has been set to 1.3, which is a bit confusing. If there is something lacking in the 1.3-implemented support please spell it out more clearly. RESTRICT corresponds to PROTECT in the Django implementation; if you do not want Django to emulate cascade then on the Django side you specify DO_NOTHING and ensure that the DB is set up properly to do the cascade itself.

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