ForeignKey.on_delete emulated only
|Reported by:||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.3|
|Severity:||Normal||Keywords:||foreign key, on delete|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||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.