當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。