def delete(self, *args, **kwargs):
        """
        Triggers a task that will unpublish the object after it is deleted.

        Save with keyword argument obj.delete(unpublish=False) to skip it.
        """
        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)
def delete ( self , * args , ** kwargs ) : from bakery import tasks from django . contrib . contenttypes . models import ContentType unpublish = kwargs . pop ( 'unpublish' , True ) super ( AutoPublishingBuildableModel , self ) . delete ( * args , ** kwargs ) if unpublish : ct = ContentType . objects . get_for_model ( self . __class__ ) tasks . unpublish_object . delay ( ct . pk , self . pk )
Triggers a task that will unpublish the object after it is deleted.

        Save with keyword argument obj.delete(unpublish=False) to skip it.