code: def delete(self, *args, **kwargs):
          
          from bakery import tasks
          from django.contrib.contenttypes.models import ContentType
          # if obj.save(unpublish=False) has been passed, we skip the task.
          unpublish = kwargs.pop('unpublish', True)
          # Delete it from the database
          super(AutoPublishingBuildableModel, self).delete(*args, **kwargs)
          if unpublish:
              ct = ContentType.objects.get_for_model(self.__class__)
              tasks.unpublish_object.delay(ct.pk, self.pk)
docs: Triggers a task that will unpublish the object after it is deleted.
  
          Save with keyword argument obj.delete(unpublish=False) to skip it.