本文整理汇总了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
示例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