コード例 #1
0
ファイル: base.py プロジェクト: geekofalltrades/QuestionTine
    def save(self, *args, **kwargs):
        new_content = True if not self.pk else False

        super(Post, self).save(*args, **kwargs)

        if new_content and self.published:
            content_published.send(self.__class__, instance=self)
        elif self.published is True and self._cached_published is False:
            content_published.send(self.__class__, instance=self)
        elif self.published is False and self._cached_published is True:
            content_unpublished.send(self.__class__, instance=self)

        self._cached_published = self.published
コード例 #2
0
ファイル: base.py プロジェクト: geekofalltrades/QuestionTine
def send_unpublished_on_post_delete(sender, instance, **kwargs):
    """Send 'content_unpublished' on hard delete."""
    if issubclass(sender, Post):
        content_unpublished.send(sender, instance=instance)