E
E
Eugene-1232020-05-03 08:06:42
Django
Eugene-123, 2020-05-03 08:06:42

What does "on_delete doesn't create a SQL constraint" mean?

Reading the Django documentation regarding model fields Link .
Regarding the on_delete argument when creating a model field, it says:

on_delete doesn't create a SQL constraint

What does this mean for a person far from databases? Does this mean that the database will eventually swell from non-deleted records?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dr. Bacon, 2020-05-03
@bacon

It was a bit short to read the following: "Cascade deletes. Django emulates the behavior of the SQL constraint ON DELETE CASCADE and also deletes the object containing the ForeignKey."

A
Ariurn, 2020-05-03
@Ariurn

To be quite blunt: the decision on what to do with the model after deleting its ForeignKey according to on_delete is made at the django level. The database does not take any part in this, it only acts as a data store.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question