当前位置: 首页>>代码示例>>Python>>正文


Python EmailNewPremium.delay方法代码示例

本文整理汇总了Python中apps.profile.tasks.EmailNewPremium.delay方法的典型用法代码示例。如果您正苦于以下问题:Python EmailNewPremium.delay方法的具体用法?Python EmailNewPremium.delay怎么用?Python EmailNewPremium.delay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在apps.profile.tasks.EmailNewPremium的用法示例。


在下文中一共展示了EmailNewPremium.delay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: activate_premium

# 需要导入模块: from apps.profile.tasks import EmailNewPremium [as 别名]
# 或者: from apps.profile.tasks.EmailNewPremium import delay [as 别名]
 def activate_premium(self):
     from apps.profile.tasks import EmailNewPremium
     EmailNewPremium.delay(user_id=self.user.pk)
     
     self.is_premium = True
     self.save()
     self.user.is_active = True
     self.user.save()
     
     subs = UserSubscription.objects.filter(user=self.user)
     for sub in subs:
         if sub.active: continue
         sub.active = True
         try:
             sub.save()
         except (IntegrityError, Feed.DoesNotExist):
             pass
     
     try:
         scheduled_feeds = [sub.feed.pk for sub in subs]
     except Feed.DoesNotExist:
         scheduled_feeds = []
     logging.user(self.user, "~SN~FMTasking the scheduling immediate premium setup of ~SB%s~SN feeds..." % 
                  len(scheduled_feeds))
     SchedulePremiumSetup.apply_async(kwargs=dict(feed_ids=scheduled_feeds))
     
     self.queue_new_feeds()
     self.setup_premium_history()
     
     logging.user(self.user, "~BY~SK~FW~SBNEW PREMIUM ACCOUNT! WOOHOO!!! ~FR%s subscriptions~SN!" % (subs.count()))
     
     return True
开发者ID:343max,项目名称:NewsBlur,代码行数:34,代码来源:models.py

示例2: activate_premium

# 需要导入模块: from apps.profile.tasks import EmailNewPremium [as 别名]
# 或者: from apps.profile.tasks.EmailNewPremium import delay [as 别名]
 def activate_premium(self):
     from apps.profile.tasks import EmailNewPremium
     EmailNewPremium.delay(user_id=self.user.pk)
     
     self.is_premium = True
     self.save()
     
     subs = UserSubscription.objects.filter(user=self.user)
     for sub in subs:
         sub.active = True
         try:
             sub.save()
             sub.feed.setup_feed_for_premium_subscribers()
         except IntegrityError, Feed.DoesNotExist:
             pass
开发者ID:Maxxx557,项目名称:NewsBlur,代码行数:17,代码来源:models.py


注:本文中的apps.profile.tasks.EmailNewPremium.delay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。