Model.delete(using=DEFAULT_DB_ALIAS, keep_parents=False)
[source]
Issues an SQL DELETE
for the object. This only deletes the object in the database; the Python instance will still exist and will still have data in its fields. This method returns the number of objects deleted and a dictionary with the number of deletions per object type.
For more details, including how to delete objects in bulk, see Deleting objects.
If you want customized deletion behavior, you can override the delete()
method. See Overriding predefined model methods for more details.
Sometimes with multi-table inheritance you may want to delete only a child model’s data. Specifying keep_parents=True
will keep the parent model’s data.
The keep_parents
parameter was added.
The return value describing the number of objects deleted was added.
Please login to continue.