def get_all_active_subscriptions(self): subscriptions = SubscriptionPlan.gql('WHERE active = True') logging.debug('Subsciptions #%s' % subscriptions.count()) viewable_subscriptions = [] for subscription in subscriptions: viewable_subscriptions.append( SubscriptionView(subscription.code, subscription.name, subscription.description)) return viewable_subscriptions
def get_all_active_subscriptions(self): subscriptions = SubscriptionPlan.gql('WHERE active = True') logging.debug('Subsciptions #%s' % subscriptions.count()) viewable_subscriptions = [] for subscription in subscriptions: viewable_subscriptions.append(SubscriptionView(subscription.code, subscription.name, subscription.description)) return viewable_subscriptions
def add_subscriptions(self): plans = SubscriptionPlan.gql("WHERE code = :code", code=SUBSCRIPTION_PLAN_MONTHLY) if plans.count() > 0: logging.debug('Subscription %s exists', SUBSCRIPTION_PLAN_MONTHLY) return '<html><body>Subscription exists</body></html>' subs = SubscriptionPlan() subs.code = SUBSCRIPTION_PLAN_MONTHLY subs.name = 'Cup of Coffee - Monthly Plan' subs.description = 'Unlimited trip creation and report generation every month for the price of a coffee. Try it free for first 15 days. Cancel anytime. No setup fees. No cancellation charges. No hidden fees.' subs.active = True subs.save() logging.debug('Subscription %s added', SUBSCRIPTION_PLAN_MONTHLY) return '<html><body>Added subscription</body></html>'