1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

#-*- coding: utf-8 -*- 

from django.conf.urls.defaults import patterns, include, url 

from shop.models.productmodel import Product 

from shop.views import ShopListView, ShopTemplateView 

from shop.views.cart import CartDetails, CartItemDetail 

from shop.views.checkout import ThankYouView, CheckoutSelectionView, \ 

    ShippingBackendRedirectView, PaymentBackendRedirectView#, SelectShippingView, SelectPaymentView, 

from shop.views.order import OrderListView, OrderDetailView 

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"), 

        name='shop_welcome'), 

 

    # Cart 

    url(r'^cart/delete/$', CartDetails.as_view(action='delete'), # DELETE  

        name='cart_delete'), 

    url('^cart/item/$', CartDetails.as_view(action='post'), # POST 

        name='cart_item_add' ), 

    url(r'^cart/$', CartDetails.as_view(), name='cart'), # GET 

    url(r'^cart/update/$', CartDetails.as_view(action='put'), 

        name='cart_update'), 

 

    # CartItems 

    url('^cart/item/(?P<id>[0-9A-Za-z-_.//]+)$', CartItemDetail.as_view(), 

        name='cart_item' ), 

 

    # Checkout 

    url(r'^checkout/$', CheckoutSelectionView.as_view(), 

        name='checkout_selection' # First step of the checkout process 

        ), 

    #url(r'^checkout/ship/$', SelectShippingView.as_view(),  

    #    name='checkout_shipping' # First step of the checkout process 

    #    ), 

    url(r'^checkout/ship/$', ShippingBackendRedirectView.as_view(), 

        name='checkout_shipping' # First step of the checkout process 

        ), 

    #url(r'^checkout/pay/$', SelectPaymentView.as_view(),  

    #    name='checkout_payment' # Second step of the checkout process 

    #    ), 

    url(r'^checkout/pay/$', PaymentBackendRedirectView.as_view(), 

        name='checkout_payment' # First step of the checkout process 

        ), 

    url(r'^checkout/thank_you/$', ThankYouView.as_view(), 

        name='thank_you_for_your_order' # Second step of the checkout process 

        ), 

    # Products 

    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' 

        ), 

 

    # Orders 

    url(r'^orders/$', 

        OrderListView.as_view(), 

        name='order_list'), 

    url(r'^orders/(?P<pk>\d+)/$', 

        OrderDetailView.as_view(), 

        name='order_detail'), 

)