Regarding the title, I have a question that I encountered while studying a book.
The actual code looked like this:
class Test_Model: user = models.ForeignKey(CustomUser, verbose_name='user', on_delete=models.PROTECT, null=True)
When I looked it up, it was an indispensable item when linking models from django 2.0. The meaning seems to be ** what to do with the associated object when the referenced object is deleted **.
There are the following types of model. ・ CASCADE Delete all associated objects
・ PROTECT Cannot be deleted if there is an associated object
・ SET_NULL The object remains, but the corresponding item becomes Null
・ SET_DEFAULT The object will remain and the corresponding item will have a default value.
・ SET () The object can set the function to the remaining corresponding item
・ DO_NOTHING Do nothing.
If you don't decide how to handle it properly ...
Reference site https://djangobrothers.com/blogs/on_delete/