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


Python cart.CartDetails类代码示例

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


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

示例1: test_01_get_context_data_works

 def test_01_get_context_data_works(self):
     self.create_fixtures()
     request = Mock()
     setattr(request, 'user', self.user)
     view = CartDetails(request=request)
     ret = view.get_context_data()
     self.assertNotEqual(ret,None)
开发者ID:MechanisM,项目名称:django-shop,代码行数:7,代码来源:views.py

示例2: _get_from_cart

 def _get_from_cart(self):
     request = Mock()
     setattr(request, 'user', self.user)
     view = CartDetails(request=request)
     ret = view.get_context_data()
     self.assertNotEqual(ret, None)
     return ret
开发者ID:jrief,项目名称:django-shop-productvariations,代码行数:7,代码来源:tests.py

示例3: test_context_has_as_many_items_as_cart

 def test_context_has_as_many_items_as_cart(self):
     self.cart.user = self.user
     self.cart.save()
     request = Mock()
     setattr(request, 'user', self.user)
     view = CartDetails(request=request)
     ret = view.get_context_data()
     self.assertNotEqual(ret,None)
     self.assertEqual(len(ret['cart_items']),1)
     self.assertEqual(ret['cart_items'][0], self.item)
开发者ID:AlexHill,项目名称:django-shop,代码行数:10,代码来源:views.py

示例4: test_calling_ajax_post_returns_content

    def test_calling_ajax_post_returns_content(self):
        self.cart.user = self.user
        self.cart.save()

        request = Mock()
        setattr(request, "is_ajax", lambda: True)
        setattr(request, "user", self.user)
        setattr(request, "session", {})
        post = {"add_item_id": self.product.pk, "add_item_quantity": 1}
        setattr(request, "POST", post)

        view = CartDetails(request=request)
        ret = view.post()
        self.assertTrue(isinstance(ret, HttpResponse))

        ret = view.get_context_data()
        self.assertNotEqual(ret, None)
        self.assertEqual(len(ret["cart_items"]), 1)

        self.assertEqual(ret["cart_items"][0], self.item)
        self.assertEqual(ret["cart_items"][0].quantity, 2)
开发者ID:berrym72,项目名称:django-shop,代码行数:21,代码来源:views.py

示例5: test_calling_ajax_post_returns_content

 def test_calling_ajax_post_returns_content(self):
     self.cart.user = self.user
     self.cart.save()
     
     request = Mock()
     setattr(request, 'is_ajax', lambda :True)
     setattr(request, 'user', self.user)
     post={
         'add_item_id':self.product.id,
         'add_item_quantity':1,
     }
     setattr(request, 'POST', post)
     
     view = CartDetails(request=request)
     ret = view.post()
     self.assertTrue(isinstance(ret,HttpResponse))
     
     ret = view.get_context_data()
     self.assertNotEqual(ret,None)
     self.assertEqual(len(ret['cart_items']),1)
     
     self.assertEqual(ret['cart_items'][0], self.item)
     self.assertEqual(ret['cart_items'][0].quantity, 2)
开发者ID:AlexHill,项目名称:django-shop,代码行数:23,代码来源:views.py

示例6: patterns

from django.conf.urls import patterns, url

from shop.views.cart import CartDetails, CartItemDetail


urlpatterns = patterns('',
    url(r'^delete/$', CartDetails.as_view(action='delete'),  # DELETE
        name='cart_delete'),
    url(r'^item/$', CartDetails.as_view(action='post'),  # POST
        name='cart_item_add'),
    url(r'^$', CartDetails.as_view(), name='cart'),  # GET
    url(r'^update/$', CartDetails.as_view(action='put'),
        name='cart_update'),

    # CartItems
    url(r'^item/(?P<id>[0-9]+)$', CartItemDetail.as_view(),
        name='cart_item'),
    url(r'^item/(?P<id>[0-9]+)/delete$',
        CartItemDetail.as_view(action='delete'),
        name='cart_item_delete'),
)
开发者ID:AirLee,项目名称:django-shop,代码行数:21,代码来源:cart.py

示例7: patterns

from shop.views import ShopDetailView, ShopListView, ShopTemplateView
from shop.views.cart import CartDetails
from shop.views.category import CategoryDetailView
from shop.views.checkout import SelectShippingView
from shop.views.product import ProductDetailView

# Loop through payment backends and mount the modules in pay/
urlpatterns = patterns('',
    (r'^pay/$', include('shop.payment.urls')),
    (r'^ship/$', include('shop.shipping.urls')),
    
    #Home
    url(r'^$', ShopTemplateView.as_view(template_name="shop/welcome.html")),
    
    # Cart
    url(r'^cart/$', CartDetails.as_view(), 
        name='cart' # NOT cart_detail since we can POST to it to add stuff
        ),
    
    # Checkout
    url(r'^checkout/$', SelectShippingView.as_view(), 
        name='checkout' # NOT cart_detail since we can POST to it to add stuff
        ),
    
    # Products
    url(r'^product/(?P<slug>[0-9A-Za-z-_.//]+)/$',
        ProductDetailView.as_view(),
        name='product_detail'
        ),
    url(r'^products/$',
        ShopListView.as_view(model=Product),
开发者ID:bbelchak,项目名称:django-shop,代码行数:31,代码来源:urls.py

示例8: import

from morozoff.apps.customshop.models import CustomProduct
from morozoff.apps.customshop.views import (MyCheckoutSelectionView,
    CartItemDeleteView, CustomCategoryShopListView)


urlpatterns = patterns('',
    # Products
    url(r'^$',
        TemplateView.as_view(template_name="index.html"),
        name='index'
    ),
    (r'^pay/', include('shop.payment.urls')),
    (r'^ship/', include('shop.shipping.urls')),
    # Cart
    url(r'^cart/delete/$',
        CartDetails.as_view(action='delete'),
        name='cart_delete'
    ),
    url(r'^cart/delete/(?P<pk>\d+)/$',
        CartItemDeleteView.as_view(),
        name='cart_delete_single'
    ),
    url('^cart/item/$',
        CartDetails.as_view(action='post'),
        name='cart_item_add'
    ),
    url(r'^cart/$',
        CartDetails.as_view(),
        name='cart'
    ),
    url(r'^cart/update/$',
开发者ID:clincher,项目名称:morozoff,代码行数:31,代码来源:urls.py

示例9: url

    # Accessories
    url(r'^accessories/$',
        AccessoryListView.as_view(),
        name='accessory-list'
    ),
    url(r'^accessories/(?P<slug>[0-9A-Za-z-_.//]+)$',
        AccessoryDetailView.as_view(),
        name='accessory_detail'
    ),
    # Payment stuff
    (r'^pay/', include('shop.payment.urls')),
    (r'^ship/', include('shop.shipping.urls')),

    # Cart
    url(r'^cart/delete/$', # DELETE
        CartDetails.as_view(action='delete'),
        name='cart_delete'
    ),
    url(r'^cart/delete/(?P<pk>\d+)/$',
        CartItemDeleteView.as_view(),
        name='cart_delete_single'
    ),
    url('^cart/item/$', # POST
        CartDetails.as_view(action='post'),
        name='cart_item_add'
    ),
    url(r'^cart/$', # GET
        CartDetails.as_view(template_name="customshop/cart.html"),
        name='cart'
    ),
    url(r'^cart/update/$',
开发者ID:jesseyv,项目名称:trailers,代码行数:31,代码来源:urls.py

示例10: url

from django.conf.urls import url

from shop.views.cart import CartDetails, CartItemDetail


urlpatterns = [
    url(r"^delete/$", CartDetails.as_view(action="delete"), name="cart_delete"),  # DELETE
    url(r"^item/$", CartDetails.as_view(action="post"), name="cart_item_add"),  # POST
    url(r"^$", CartDetails.as_view(), name="cart"),  # GET
    url(r"^update/$", CartDetails.as_view(action="put"), name="cart_update"),
    # CartItems
    url(r"^item/(?P<id>[0-9]+)$", CartItemDetail.as_view(), name="cart_item"),
    url(r"^item/(?P<id>[0-9]+)/delete$", CartItemDetail.as_view(action="delete"), name="cart_item_delete"),
]
开发者ID:katomaso,项目名称:django-shop,代码行数:14,代码来源:cart.py

示例11: test_get_context_data_works

 def test_get_context_data_works(self):
     request = Mock()
     setattr(request, "user", self.user)
     view = CartDetails(request=request)
     ret = view.get_context_data()
     self.assertNotEqual(ret, None)
开发者ID:berrym72,项目名称:django-shop,代码行数:6,代码来源:views.py


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