• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python order.get_order_from_request函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_request_with_user_returns_last_order

    def test_request_with_user_returns_last_order(self):
        setattr(self.request, 'user', self.user)

        order1 = Order.objects.create(user=self.user)
        ret = get_order_from_request(self.request)
        self.assertEqual(ret, order1)

        order2 = Order.objects.create(user=self.user)
        ret = get_order_from_request(self.request)
        self.assertEqual(ret, order2)
开发者ID:bakanov,项目名称:django-shop,代码行数:10,代码来源:order.py


示例2: test_04_request_with_user_returns_correct_order

 def test_04_request_with_user_returns_correct_order(self):
     self.create_fixtures()
     setattr(self.request, 'user', self.user)
     self.order.user = self.user
     self.order.save()
     ret = get_order_from_request(self.request)
     self.assertEqual(ret, self.order)
开发者ID:FinalAngel,项目名称:django-shop,代码行数:7,代码来源:order.py


示例3: get_context_data

    def get_context_data(self, **kwargs):
        ctx = super(ShopTemplateView, self).get_context_data(**kwargs)

        # Set the order status:
        order = get_order_from_request(self.request)

        
        if order:
            order.status = Order.COMPLETED
            order.save()
            
        else:
            order = Order.objects.get_latest_for_user(self.request.user)
            #TODO: Is this ever the case?
        ctx.update({'order': order, })
        
        # TODO: move away from shop!!
        # ctx.update({'downloads': [1], })

        
        completed.send(sender=self, order=order)

        # Empty the customers basket, to reflect that the purchase was
        # completed
        cart_object = get_or_create_cart(self.request)
        cart_object.empty()

        return ctx
开发者ID:alainwolf,项目名称:openbroadcast.org,代码行数:28,代码来源:checkout.py


示例4: test_03_request_with_order_returns_order

 def test_03_request_with_order_returns_order(self):
     self.create_fixtures()
     session = {}
     session['order_id'] = self.order.id
     setattr(self.request, 'session', session)
     ret = get_order_from_request(self.request)
     self.assertEqual(ret, self.order)
开发者ID:FinalAngel,项目名称:django-shop,代码行数:7,代码来源:order.py


示例5: get_context_data

 def get_context_data(self, **kwargs):
     ctx = super(MyOrderConfirmView, self).get_context_data(**kwargs)
     order = get_order_from_request(self.request)
     ctx.update({
         'order': order,
     })
     return ctx
开发者ID:berrym72,项目名称:django-shop,代码行数:7,代码来源:views.py


示例6: entry_view

def entry_view(request, *args, **kwargs):
    """Call card's provider API with correct price and payment description."""
    order = get_order_from_request(request)
    amount = order.get_total()
    return HttpResponseRedirect(
        'https://visa.com/payment',
        data={'key': 'my_secret_key',
              'amount': amount})
开发者ID:katomaso,项目名称:django-shop,代码行数:8,代码来源:credit_card.py


示例7: get_context_data

    def get_context_data(self, **kwargs):
        ctx = super(ShopTemplateView, self).get_context_data(**kwargs)

        # put the latest order in the context only if it is completed
        order = get_order_from_request(self.request)
        if order and order.status == Order.COMPLETED:
            ctx.update({'order': order, })
        return ctx
开发者ID:javierwilson,项目名称:django-shop,代码行数:8,代码来源:checkout.py


示例8: test_addresses_are_conserved_properly

 def test_addresses_are_conserved_properly(self):
     session = {}
     session['order_id'] = self.order.id
     setattr(self.request, 'session', session)
     ret = get_order_from_request(self.request)
     self.assertEqual(ret, self.order)
     self.assertEqual(ret.shipping_address_text,
                     self.order.shipping_address_text)
     self.assertEqual(ret.billing_address_text,
                     self.order.billing_address_text)
开发者ID:bakanov,项目名称:django-shop,代码行数:10,代码来源:order.py


示例9: get_context_data

    def get_context_data(self, **kwargs):
        ctx = super(ShopTemplateView, self).get_context_data(**kwargs)

        # Set the order status:
        order = get_order_from_request(self.request)
        order.status = Order.COMPLETED
        order.save()
        completed.send(sender=self, order=order)

        return ctx
开发者ID:sikhosonke-manyela,项目名称:django-shop,代码行数:10,代码来源:checkout.py


示例10: get_order

 def get_order(self, request):
     '''
     Returns the order object for the current shopper.
     
     This is called from the backend's views as: 
     >>> order = self.shop.getOrder(request)
     '''
     # it might seem a bit strange to simply forward the call to a helper, 
     # but this avoids exposing the shop's internal workings to module 
     # writers
     return get_order_from_request(request)
开发者ID:audreyr,项目名称:django-shop,代码行数:11,代码来源:backend_base.py


示例11: get_context_data

    def get_context_data(self, **kwargs):
        ctx = super(ShopTemplateView, self).get_context_data(**kwargs)

        # put the latest order in the context only if it is completed
        order = get_order_from_request(self.request)
        if order and order.status == Order.COMPLETED:
            ctx.update({'order': order, })
            # Empty the customers basket, to reflect that the purchase was
            # completed
            cart_object = get_or_create_cart(self.request)
            cart_object.empty()

        return ctx
开发者ID:commoncode,项目名称:django-shop,代码行数:13,代码来源:checkout.py


示例12: get_context_data

    def get_context_data(self, **kwargs):
        ctx = super(ShopTemplateView, self).get_context_data(**kwargs)

        # Set the order status:
        order = get_order_from_request(self.request)
        order.status = Order.COMPLETED
        order.save()
        completed.send(sender=self, order=order)

        # Empty the customers basket, to reflect that the purchase was completed
        cart_object = get_or_create_cart(self.request)
        cart_object.empty()

        return ctx
开发者ID:RuuPiE,项目名称:django-shop,代码行数:14,代码来源:checkout.py


示例13: callback_view

def callback_view(request, *args, **kwargs):
    """Receive callback from credit card payment service and complete the order."""
    order = get_order_from_request(request)

    OrderPayment.objects.create(
        order=order,
        amount=request.POST["amount"],
        transaction_id=request.POST["id"],
        payment_method=PaymentBackend.objects.get(url_name="credit_card"))

    order.mark_as_completed()
    clean_cart(request)

    return HttpResponseRedirect(reverse("home"))
开发者ID:katomaso,项目名称:django-shop,代码行数:14,代码来源:credit_card.py


示例14: pay_on_delivery

def pay_on_delivery(request):
    """
    This simple PaymentBackend has only one view - entry point which does some work
    internally and then redirects to the "successful URL".
    More complicated views should have entry point (where it calls external API)
    and a callback view which will be called by the API with result.
    """
    # Get the order object
    order = get_order_from_request(request)
    # Since we don't know if the money will be really collected mark the order
    # just as CONFIRMED instead of COMPLETED.
    order.mark_as_confirmed()
    clean_cart(request)
    return HttpResponseRedirect(reverse("home"))
开发者ID:katomaso,项目名称:django-shop,代码行数:14,代码来源:pay_on_delivery.py


示例15: test_request_with_session_without_order_returns_none

 def test_request_with_session_without_order_returns_none(self):
     setattr(self.request, "session", {})
     ret = get_order_from_request(self.request)
     self.assertEqual(ret, None)
开发者ID:wmsmith,项目名称:django-shop,代码行数:4,代码来源:order.py


示例16: test_request_with_order_returns_order

 def test_request_with_order_returns_order(self):
     session = {}
     session['order_id'] = self.order.pk
     setattr(self.request, 'session', session)
     ret = get_order_from_request(self.request)
     self.assertEqual(ret, self.order)
开发者ID:AirLee,项目名称:django-shop,代码行数:6,代码来源:order.py


示例17: test_01_request_without_user_or_session_returns_none

 def test_01_request_without_user_or_session_returns_none(self):
     self.create_fixtures()
     ret = get_order_from_request(self.request)
     self.assertEqual(ret, None)
开发者ID:FinalAngel,项目名称:django-shop,代码行数:4,代码来源:order.py


示例18: test_02_request_with_session_without_order_returns_none

 def test_02_request_with_session_without_order_returns_none(self):
     self.create_fixtures()
     setattr(self.request,'session', {})
     ret = get_order_from_request(self.request)
     self.assertEqual(ret, None)
开发者ID:FinalAngel,项目名称:django-shop,代码行数:5,代码来源:order.py


示例19: test_request_with_user_returns_correct_order

 def test_request_with_user_returns_correct_order(self):
     setattr(self.request, "user", self.user)
     self.order.user = self.user
     self.order.save()
     ret = get_order_from_request(self.request)
     self.assertEqual(ret, self.order)
开发者ID:wmsmith,项目名称:django-shop,代码行数:6,代码来源:order.py


示例20: test_request_with_order_returns_order

 def test_request_with_order_returns_order(self):
     session = {}
     session["order_id"] = self.order.id
     setattr(self.request, "session", session)
     ret = get_order_from_request(self.request)
     self.assertEqual(ret, self.order)
开发者ID:wmsmith,项目名称:django-shop,代码行数:6,代码来源:order.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cart.CartDetails类代码示例发布时间:2022-05-27
下一篇:
Python order.add_order_to_request函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap