本文整理匯總了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
示例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