當前位置: 首頁>>代碼示例>>Python>>正文


Python tasks.EmailNewPremium類代碼示例

本文整理匯總了Python中apps.profile.tasks.EmailNewPremium的典型用法代碼示例。如果您正苦於以下問題:Python EmailNewPremium類的具體用法?Python EmailNewPremium怎麽用?Python EmailNewPremium使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了EmailNewPremium類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: activate_premium

 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,代碼行數:32,代碼來源:models.py

示例2: activate_premium

 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,代碼行數:15,代碼來源:models.py


注:本文中的apps.profile.tasks.EmailNewPremium類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。