當前位置: 首頁>>代碼示例>>Python>>正文


Python product.ProductDetailView類代碼示例

本文整理匯總了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;未經允許,請勿轉載。