本文整理匯總了Python中oscar.core.loading.get_model方法的典型用法代碼示例。如果您正苦於以下問題:Python loading.get_model方法的具體用法?Python loading.get_model怎麽用?Python loading.get_model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類oscar.core.loading
的用法示例。
在下文中一共展示了loading.get_model方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: remove_ancestor_slugs
# 需要導入模塊: from oscar.core import loading [as 別名]
# 或者: from oscar.core.loading import get_model [as 別名]
def remove_ancestor_slugs(apps, schema_editor):
MigrationCategory = apps.get_model('catalogue', 'Category')
for category in MigrationCategory.objects.all():
category.slug = category.slug.split(ORMCategory._slug_separator)[-1]
category.save()
示例2: add_ancestor_slugs
# 需要導入模塊: from oscar.core import loading [as 別名]
# 或者: from oscar.core.loading import get_model [as 別名]
def add_ancestor_slugs(apps, schema_editor):
MigrationCategory = apps.get_model('catalogue', 'Category')
for category in MigrationCategory.objects.all():
orm_category = ORMCategory.objects.get(pk=category.pk)
category.slug = orm_category.full_slug
category.save()
示例3: get_target_property
# 需要導入模塊: from oscar.core import loading [as 別名]
# 或者: from oscar.core.loading import get_model [as 別名]
def get_target_property():
return get_model('catalogue', 'Product')
示例4: target_model
# 需要導入模塊: from oscar.core import loading [as 別名]
# 或者: from oscar.core.loading import get_model [as 別名]
def target_model(self):
return get_model('catalogue', 'product')
示例5: __init__
# 需要導入模塊: from oscar.core import loading [as 別名]
# 或者: from oscar.core.loading import get_model [as 別名]
def __init__(self, **kwargs):
super(AdminProductChooser, self).__init__(**kwargs)
Product = get_model('catalogue', 'Product')
self.target_content_type = ContentType.objects.get_for_model(Product)
示例6: target_model
# 需要導入模塊: from oscar.core import loading [as 別名]
# 或者: from oscar.core.loading import get_model [as 別名]
def target_model(self):
return get_model('catalogue', 'Product')
示例7: update_child_vouchers
# 需要導入模塊: from oscar.core import loading [as 別名]
# 或者: from oscar.core.loading import get_model [as 別名]
def update_child_vouchers(voucher_id):
Voucher = get_model('voucher', 'Voucher')
parent = Voucher.objects.get(pk=voucher_id)
parent.update_children()
示例8: add_child_codes
# 需要導入模塊: from oscar.core import loading [as 別名]
# 或者: from oscar.core.loading import get_model [as 別名]
def add_child_codes(voucher_id, child_count):
Voucher = get_model('voucher', 'Voucher')
parent = Voucher.objects.get(pk=voucher_id)
parent.create_children(child_count)
parent.save()