3/24/2018 - 9:22 PM

Django on_delete

The possible values for on_delete are found in django.db.models:

        Cascade deletes. Django emulates the behavior of the SQL constraint ON DELETE CASCADE and also deletes the object containing the ForeignKey.

        Prevent deletion of the referenced object by raising ProtectedError, a subclass of django.db.IntegrityError.

        Set the ForeignKey null; this is only possible if null is True.

        Set the ForeignKey to its default value; a default for the ForeignKey must be set.

        Set the ForeignKey to the value passed to SET(), or if a callable is passed in, the result of calling it. In most cases, passing a callable will be necessary to avoid executing queries at the time your is imported: