当前位置: 首页>>代码示例>>Python>>正文


Python models.AddonUpsell类代码示例

本文整理汇总了Python中addons.models.AddonUpsell的典型用法代码示例。如果您正苦于以下问题:Python AddonUpsell类的具体用法?Python AddonUpsell怎么用?Python AddonUpsell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AddonUpsell类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_free_with_in_app_deletes_upsell

 def test_free_with_in_app_deletes_upsell(self):
     self.make_premium(self.webapp)
     new_upsell_app = Addon.objects.create(type=self.webapp.type,
         status=self.webapp.status, name='upsell-%s' % self.webapp.id,
         premium_type=amo.ADDON_FREE)
     new_upsell = AddonUpsell(premium=self.webapp)
     new_upsell.free = new_upsell_app
     new_upsell.save()
     assert self.webapp.upsold is not None
     res = self.client.post(
         self.url, self.get_postdata({'price': 'free',
                                      'allow_inapp': 'True'}), follow=True)
     eq_(self.get_webapp().upsold, None)
开发者ID:smillaedler,项目名称:zamboni,代码行数:13,代码来源:test_views_payments.py

示例2: update_upsell

 def update_upsell(self, bundle):
     if 'upsold' in bundle.data:
         if bundle.obj.premium_type in amo.ADDON_FREES:
             raise fields.ApiFieldError('Free apps cannot have upsells.')
         free_app = self.fields['upsold'].hydrate(bundle).obj
         current_upsell = bundle.obj.upsold
         if not current_upsell:
             log.debug('[[email protected]%s] Creating app upsell' % bundle.obj.pk)
             current_upsell = AddonUpsell(premium=bundle.obj)
         current_upsell.free = free_app
         current_upsell.save()
         # smack that cached property right back out
         del bundle.obj.__dict__['upsold']
     return bundle
开发者ID:markgif,项目名称:zamboni,代码行数:14,代码来源:resources.py

示例3: save

    def save(self):
        if 'paypal_id' in self.cleaned_data:
            self.addon.paypal_id = self.cleaned_data['paypal_id']
            self.addon.support_email = self.cleaned_data['support_email']
            self.addon.save()

        if 'price' in self.cleaned_data:
            premium = self.addon.premium
            if not premium:
                premium = AddonPremium()
                premium.addon = self.addon
            premium.price = self.cleaned_data['price']
            premium.save()

        upsell = self.addon.upsold
        if (self.cleaned_data['do_upsell'] and
            self.cleaned_data['text'] and self.cleaned_data['free']):

            if not upsell:
                upsell = AddonUpsell(premium=self.addon)
            upsell.text = self.cleaned_data['text']
            upsell.free = self.cleaned_data['free']
            upsell.save()
        elif not self.cleaned_data['do_upsell'] and upsell:
            upsell.delete()
开发者ID:atassumer,项目名称:zamboni,代码行数:25,代码来源:forms.py

示例4: save

    def save(self):
        if 'paypal_id' in self.cleaned_data:
            self.addon.paypal_id = self.cleaned_data['paypal_id']
            self.addon.support_email = self.cleaned_data['support_email']
            self.addon.save()

        if 'price' in self.cleaned_data:
            premium = self.addon.premium
            if not premium:
                premium = AddonPremium()
                premium.addon = self.addon
            premium.price = self.cleaned_data['price']
            premium.save()

        upsell = self.addon.upsold
        if (self.cleaned_data['do_upsell'] and
            self.cleaned_data['text'] and self.cleaned_data['free']):

            # Check if this app was already a premium version for another app.
            if upsell and upsell.free != self.cleaned_data['free']:
                upsell.delete()

            if not upsell:
                upsell = AddonUpsell(premium=self.addon)
            upsell.text = self.cleaned_data['text']
            upsell.free = self.cleaned_data['free']
            upsell.save()
        elif not self.cleaned_data['do_upsell'] and upsell:
            upsell.delete()
开发者ID:albre2252,项目名称:zamboni,代码行数:29,代码来源:forms.py

示例5: save

    def save(self):
        if 'price' in self.cleaned_data:
            premium = self.addon.premium
            if not premium:
                premium = AddonPremium()
                premium.addon = self.addon
            premium.price = self.cleaned_data['price']
            premium.save()

        upsell = self.addon.upsold
        if (self.cleaned_data['do_upsell'] and
            self.cleaned_data['text'] and self.cleaned_data['free']):

            # Check if this app was already a premium version for another app.
            if upsell and upsell.free != self.cleaned_data['free']:
                upsell.delete()

            if not upsell:
                upsell = AddonUpsell(premium=self.addon)
            upsell.text = self.cleaned_data['text']
            upsell.free = self.cleaned_data['free']
            upsell.save()
        elif not self.cleaned_data['do_upsell'] and upsell:
            upsell.delete()

        self.addon.premium_type = self.cleaned_data['premium_type']
        self.addon.support_email = self.cleaned_data['support_email']
        self.addon.save()

        # If they checked later in the wizard and then decided they want
        # to keep it free, push to pending.
        if (not self.addon.paypal_id and self.addon.is_incomplete()
            and not self.addon.needs_paypal()):
            self.addon.mark_done()
开发者ID:beenishkhan,项目名称:zamboni,代码行数:34,代码来源:forms.py

示例6: save

    def save(self):
        if "paypal_id" in self.cleaned_data:
            self.addon.paypal_id = self.cleaned_data["paypal_id"]
            self.addon.support_email = self.cleaned_data["support_email"]
            self.addon.save()

        if "price" in self.cleaned_data:
            premium = self.addon.premium
            if not premium:
                premium = AddonPremium()
                premium.addon = self.addon
            premium.price = self.cleaned_data["price"]
            premium.save()

        upsell = self.addon.upsold
        if self.cleaned_data["do_upsell"] and self.cleaned_data["text"] and self.cleaned_data["free"]:

            # Check if this app was already a premium version for another app.
            if upsell and upsell.free != self.cleaned_data["free"]:
                upsell.delete()

            if not upsell:
                upsell = AddonUpsell(premium=self.addon)
            upsell.text = self.cleaned_data["text"]
            upsell.free = self.cleaned_data["free"]
            upsell.save()
        elif not self.cleaned_data["do_upsell"] and upsell:
            upsell.delete()
开发者ID:rafrombrc,项目名称:zamboni,代码行数:28,代码来源:forms.py

示例7: save

    def save(self):
        if self.cleaned_data['paypal_id']:
            if (self.addon.paypal_id
                and self.addon.paypal_id != self.cleaned_data['paypal_id']
                and self.addon.premium
                and self.addon.premium.paypal_permissions_token):
                # If a user changes their paypal id, then we need
                # to nuke the token.
                self.addon.premium.paypal_permissions_token = ''
                self.addon.premium.save()
            self.addon.paypal_id = self.cleaned_data['paypal_id']
            self.addon.support_email = self.cleaned_data['support_email']
            self.addon.save()

        if self.cleaned_data['price']:
            premium = self.addon.premium
            if not premium:
                premium = AddonPremium()
                premium.addon = self.addon
            premium.price = self.cleaned_data['price']
            premium.save()

        upsell = self.addon.upsold
        if (self.cleaned_data['do_upsell'] and
            self.cleaned_data['text'] and self.cleaned_data['free']):

            if not upsell:
                upsell = AddonUpsell(premium=self.addon)
            upsell.text = self.cleaned_data['text']
            upsell.free = self.cleaned_data['free']
            upsell.save()
        elif not self.cleaned_data['do_upsell'] and upsell:
            upsell.delete()
开发者ID:chenba,项目名称:zamboni,代码行数:33,代码来源:forms.py

示例8: test_free_with_in_app_deletes_upsell

 def test_free_with_in_app_deletes_upsell(self):
     self.make_premium(self.webapp)
     new_upsell_app = Addon.objects.create(
         type=self.webapp.type,
         status=self.webapp.status,
         name="upsell-%s" % self.webapp.id,
         premium_type=amo.ADDON_FREE,
     )
     new_upsell = AddonUpsell(premium=self.webapp)
     new_upsell.free = new_upsell_app
     new_upsell.save()
     assert self.webapp.upsold is not None
     self.client.post(
         self.url,
         self.get_postdata({"price": "free", "allow_inapp": "True", "regions": ALL_PAID_REGION_IDS}),
         follow=True,
     )
     eq_(self.get_webapp().upsold, None)
开发者ID:kmaglione,项目名称:zamboni,代码行数:18,代码来源:test_views_payments.py

示例9: save_upsold

    def save_upsold(self, obj, upsold):
        current_upsell = obj.upsold
        if upsold and upsold != obj.upsold.free:
            if not current_upsell:
                log.debug('[[email protected]%s] Creating app upsell' % obj.pk)
                current_upsell = AddonUpsell(premium=obj)
            current_upsell.free = upsold
            current_upsell.save()

        elif current_upsell:
            # We're deleting the upsell.
            log.debug('[[email protected]%s] Deleting the app upsell' % obj.pk)
            current_upsell.delete()
开发者ID:BIGGANI,项目名称:zamboni,代码行数:13,代码来源:api.py

示例10: save

    def save(self):
        if 'price' in self.cleaned_data:
            premium = self.addon.premium
            if not premium:
                premium = AddonPremium()
                premium.addon = self.addon
            premium.price = self.cleaned_data['price']
            premium.save()

        upsell = self.addon.upsold
        if (self.cleaned_data['do_upsell'] and
            self.cleaned_data['text'] and self.cleaned_data['free']):

            # Check if this app was already a premium version for another app.
            if upsell and upsell.free != self.cleaned_data['free']:
                upsell.delete()

            if not upsell:
                upsell = AddonUpsell(premium=self.addon)
            upsell.text = self.cleaned_data['text']
            upsell.free = self.cleaned_data['free']
            upsell.save()
        elif not self.cleaned_data['do_upsell'] and upsell:
            upsell.delete()

        # Check for free -> paid for already public apps.
        premium_type = self.cleaned_data['premium_type']
        if (self.addon.premium_type == amo.ADDON_FREE and
            premium_type in amo.ADDON_PREMIUMS and
            self.addon.status == amo.STATUS_PUBLIC):
            # Free -> paid for public apps trigger re-review.
            log.info(u'[Webapp:%s] (Re-review) Public app, free -> paid.' % (
                self.addon))
            RereviewQueue.flag(self.addon, amo.LOG.REREVIEW_FREE_TO_PAID)

        self.addon.premium_type = premium_type
        self.addon.save()

        # If they checked later in the wizard and then decided they want
        # to keep it free, push to pending.
        if (not self.addon.needs_paypal() and self.addon.is_incomplete()):
            self.addon.mark_done()
开发者ID:lauraxt,项目名称:zamboni,代码行数:42,代码来源:forms.py

示例11: save

    def save(self):
        current_upsell = self.addon.upsold
        new_upsell_app = self.cleaned_data.get('upsell_of')

        if new_upsell_app:
            # We're changing the upsell or creating a new one.

            if not current_upsell:
                # If the upsell is new or we just deleted the old upsell,
                # create a new upsell.
                log.debug('[[email protected]%s] Creating app upsell' % self.addon.pk)
                current_upsell = AddonUpsell(premium=self.addon)

            # Set the upsell object to point to the app that we're upselling.
            current_upsell.free = new_upsell_app
            current_upsell.save()

        elif current_upsell:
            # We're deleting the upsell.
            log.debug('[[email protected]%s] Deleting the app upsell' % self.addon.pk)
            current_upsell.delete()
开发者ID:aspes,项目名称:zamboni,代码行数:21,代码来源:forms_payments.py


注:本文中的addons.models.AddonUpsell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。