Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
    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