When it comes to deleting objects, we have two options. We can delete a single object or multiple objects.
So if you have a collection, you can delete that collection by using the ‘.delete’ method.
def say_hello(request): '''deletes a single object''' collection = Collection(pk=11) collection.delete() passTo delete multiple objects, first we need to get a queryset. For instasnce, lets say we want to delete all objects that have an id greater than 5
Collection.objects.filter(id___gt=5).delete()# this returns a queryset, and then we can delete the queryset