本文整理汇总了Python中market.models.AddonPremium类的典型用法代码示例。如果您正苦于以下问题:Python AddonPremium类的具体用法?Python AddonPremium怎么用?Python AddonPremium使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AddonPremium类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
示例2: 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
示例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']):
# 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
示例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:rafrombrc,项目名称:zamboni,代码行数:28,代码来源:forms.py
示例5: 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
示例6: save_price
def save_price(self, obj, price):
premium = obj.premium
if not premium:
premium = AddonPremium()
premium.addon = obj
premium.price = Price.objects.active().get(price=price)
premium.save()
开发者ID:BIGGANI,项目名称:zamboni,代码行数:7,代码来源:api.py
示例7: test_is_complete
def test_is_complete(self):
ap = AddonPremium(addon=self.addon)
assert not ap.is_complete()
ap.price = self.tier_one
assert not ap.is_complete()
ap.addon.paypal_id = "asd"
assert ap.is_complete()
开发者ID:kmaglione,项目名称:zamboni,代码行数:7,代码来源:test_models.py
示例8: test_price_locale
def test_price_locale(self):
ap = AddonPremium(addon=self.addon, price=self.tier_one)
eq_(ap.get_price_locale('CAD'), 'CA$3.01')
开发者ID:JohnTheBeloved,项目名称:zamboni,代码行数:3,代码来源:test_models.py
示例9: test_has_price
def test_has_price(self):
ap = AddonPremium(addon=self.addon, price=self.tier_one)
eq_(ap.has_price(), True)
self.tier_one.update(price=Decimal('0.00'))
eq_(ap.has_price(), False)
开发者ID:JohnTheBeloved,项目名称:zamboni,代码行数:6,代码来源:test_models.py
示例10: test_add_currency
def test_add_currency(self):
ap = AddonPremium(addon=self.addon, price=self.tier_one,
currencies=['USD', 'CAD'])
eq_(len(ap.supported_currencies()), 2)
eq_(ap.supported_currencies()[1][0], 'CAD')
开发者ID:MaxDumont,项目名称:zamboni,代码行数:5,代码来源:test_models.py
示例11: test_has_valid_permissions_token
def test_has_valid_permissions_token(self, check_permission):
ap = AddonPremium(addon=self.addon)
assert not ap.has_valid_permissions_token()
check_permission.return_value = True
ap.paypal_permissions_token = 'some_token'
assert ap.has_valid_permissions_token()
开发者ID:jvillalobos,项目名称:zamboni,代码行数:6,代码来源:test_models.py
示例12: test_has_permissions_token
def test_has_permissions_token(self):
ap = AddonPremium(addon=self.addon)
assert not ap.has_permissions_token()
ap.paypal_permissions_token = 'asd'
assert ap.has_permissions_token()
开发者ID:jvillalobos,项目名称:zamboni,代码行数:5,代码来源:test_models.py
示例13: test_has_valid_permissions_token_ignore
def test_has_valid_permissions_token_ignore(self):
ap = AddonPremium(addon=self.addon)
assert ap.has_valid_permissions_token()
ap.paypal_permissions_token = 'asd'
assert ap.has_valid_permissions_token()
开发者ID:jvillalobos,项目名称:zamboni,代码行数:5,代码来源:test_models.py
示例14: test_currencies
def test_currencies(self):
ap = AddonPremium(addon=self.addon, price=self.tier_one)
assert self.tier_one.currencies()
eq_(len(ap.supported_currencies()), 1)
eq_(ap.supported_currencies()[0][0], 'USD')
开发者ID:MaxDumont,项目名称:zamboni,代码行数:5,代码来源:test_models.py
注:本文中的market.models.AddonPremium类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论