def create_feed_post_feed_item(sender, instance, created, **kwargs): if created: feed_item = FeedItem() feed_item.user_id = instance.author_id feed_item.type = FeedItem.FEED_POST feed_item.feed_post = instance feed_item.save()
def create_chapter_feed_item(sender, instance, created, **kwargs): if created: feed_item = FeedItem() feed_item.user_id = instance.creator_id feed_item.type = FeedItem.NEW_CHAPTER feed_item.chapter = instance feed_item.save()
def create_screenshot_feed_item(sender, instance, created, **kwargs): if created: feed_item = FeedItem() feed_item.user_id = instance.poster_id feed_item.type = FeedItem.SCREENSHOT feed_item.screenshot = instance feed_item.save()
def create_award_feed_item(sender, instance, created, **kwargs): if created: feed_item = FeedItem() feed_item.user_id = instance.recipient_id feed_item.type = FeedItem.AWARD feed_item.award_id = instance.award_id feed_item.save()
def create_quote_feed_item(sender, instance, created, **kwargs): if created: feed_item = FeedItem() feed_item.user_id = instance.poster_id feed_item.type = FeedItem.QUOTE feed_item.quote = instance feed_item.save()
def create_news_feed_item(sender, instance, created, **kwargs): if created: feed_item = FeedItem() feed_item.user_id = instance.article.author_id feed_item.type = FeedItem.NEWS feed_item.news = instance feed_item.save()
def create_rank_feed_item(sender, instance, created, **kwargs): old_rank = instance.rank_tracker.changed().get('rank') if old_rank: feed_item = FeedItem() if old_rank < instance.rank_id: # promotion feed_item.type = FeedItem.PROMOTION if old_rank > instance.rank_id: # demotion feed_item.type = FeedItem.DEMOTION if instance.rank_id is None: # kicked feed_item.type = Notification.KICKED feed_item.user = instance feed_item.rank_id = instance.rank_id feed_item.save()