本文整理汇总了Python中shop.views.product.ProductDetailView类的典型用法代码示例。如果您正苦于以下问题:Python ProductDetailView类的具体用法?Python ProductDetailView怎么用?Python ProductDetailView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProductDetailView类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: ProductDetailViewTestCase
class ProductDetailViewTestCase(TestCase):
def create_fixtures(self):
self.product = Product()
self.product.name = 'test'
self.product.short_description = 'test'
self.product.long_description = 'test'
self.product.unit_price = Decimal('1.0')
self.product.save()
self.view = ProductDetailView(kwargs={'pk':self.product.id})
def test_01_get_product_returns_correctly(self):
self.create_fixtures()
setattr(self.view, 'object', None)
obj = self.view.get_object()
inst = isinstance(obj,Product)
self.assertEqual(inst, True)
def test_02_get_templates_return_expected_values(self):
self.create_fixtures()
self.view = ProductDetailView()
setattr(self.view, 'object', None)
tmp = self.view.get_template_names()
self.assertEqual(len(tmp), 1)
开发者ID:MechanisM,项目名称:django-shop,代码行数:25,代码来源:views.py
示例2: create_fixtures
def create_fixtures(self):
self.product = Product()
self.product.name = 'test'
self.product.short_description = 'test'
self.product.long_description = 'test'
self.product.unit_price = Decimal('1.0')
self.product.save()
self.view = ProductDetailView(kwargs={'pk':self.product.id})
开发者ID:MechanisM,项目名称:django-shop,代码行数:10,代码来源:views.py
示例3: setUp
def setUp(self):
self.product = Product()
self.product.name = 'test'
self.product.short_description = 'test'
self.product.long_description = 'test'
self.product.unit_price = Decimal('1.0')
self.product.save()
self.view = ProductDetailView(kwargs={'pk': self.product.pk})
开发者ID:albeirochoa,项目名称:django-shop,代码行数:10,代码来源:views.py
示例4: setUp
def setUp(self):
self.product = Product()
self.product.name = "test"
self.product.short_description = "test"
self.product.long_description = "test"
self.product.unit_price = Decimal("1.0")
self.product.active = True
self.product.save()
self.view = ProductDetailView(kwargs={"pk": self.product.pk})
开发者ID:berrym72,项目名称:django-shop,代码行数:11,代码来源:views.py
示例5: ProductDetailViewTestCase
class ProductDetailViewTestCase(TestCase):
def setUp(self):
self.product = Product()
self.product.name = "test"
self.product.short_description = "test"
self.product.long_description = "test"
self.product.unit_price = Decimal("1.0")
self.product.active = True
self.product.save()
self.view = ProductDetailView(kwargs={"pk": self.product.pk})
def test_get_product_returns_correctly(self):
setattr(self.view, "object", None)
obj = self.view.get_object()
inst = isinstance(obj, Product)
self.assertEqual(inst, True)
def test_get_templates_return_expected_values(self):
self.view = ProductDetailView()
setattr(self.view, "object", None)
tmp = self.view.get_template_names()
self.assertEqual(len(tmp), 1)
开发者ID:berrym72,项目名称:django-shop,代码行数:24,代码来源:views.py
示例6: test_02_get_templates_return_expected_values
def test_02_get_templates_return_expected_values(self):
self.create_fixtures()
self.view = ProductDetailView()
setattr(self.view, 'object', None)
tmp = self.view.get_template_names()
self.assertEqual(len(tmp), 1)
开发者ID:MechanisM,项目名称:django-shop,代码行数:6,代码来源:views.py
示例7: patterns
from django.conf.urls.defaults import patterns, url
from shop.views import ShopListView
from shop.views.product import ProductDetailView
from shop.models.productmodel import Product
urlpatterns = patterns('',
url(r'^w$', # hack to get page from cms
ShopListView.as_view(model=Product),
name='shop_welcome'
),
url(r'^products/$',
ShopListView.as_view(model=Product),
name='product_list'
),
url(r'^products/(?P<slug>[0-9A-Za-z-_.//]+)/$',
ProductDetailView.as_view(),
name='product_detail'
),
)
开发者ID:alainwolf,项目名称:openbroadcast.org,代码行数:21,代码来源:urls_catalog.py
示例8: patterns
from django.conf.urls.defaults import patterns, url
from shop.views import ShopListView
from shop.views.product import ProductDetailView
from shop.models.productmodel import Product
urlpatterns = patterns(
"",
url(r"^$", ShopListView.as_view(model=Product), name="product_list"),
url(r"^(?P<slug>[0-9A-Za-z-_.//]+)/$", ProductDetailView.as_view(), name="product_detail"),
)
开发者ID:ronkhan,项目名称:django-shop,代码行数:12,代码来源:catalog.py
注:本文中的shop.views.product.ProductDetailView类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论