本文整理汇总了Python中shop.util.order.add_order_to_request函数的典型用法代码示例。如果您正苦于以下问题:Python add_order_to_request函数的具体用法?Python add_order_to_request怎么用?Python add_order_to_request使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_order_to_request函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_06_same_user_does_not_override
def test_06_same_user_does_not_override(self):
self.create_fixtures()
self.order.user = self.user
self.order.save()
setattr(self.request,'user', self.user)
add_order_to_request(self.request, self.order)
self.assertEqual(self.order.user, self.user)
示例2: create_order_object_from_cart
def create_order_object_from_cart(self):
"""
This will create an Order object form the current cart, and will pass
a reference to the Order on either the User object or the session.
"""
cart = get_or_create_cart(self.request)
order = Order.objects.create_from_cart(cart)
request = self.request
add_order_to_request(request, order)
示例3: create_order_object_from_cart
def create_order_object_from_cart(self):
"""Create an Order object form the current cart.
Pass a reference to the Order on either the User object or the session.
"""
from shop.models import LazyOrder
cart = get_or_create_cart(self.request)
cart.update(self.request)
order = LazyOrder().objects.create_from_cart(cart, self.request)
add_order_to_request(self.request, order)
return order
示例4: test_06_set_order_to_user_works
def test_06_set_order_to_user_works(self):
self.create_fixtures()
setattr(self.request,'user', self.user)
add_order_to_request(self.request, self.order)
self.assertEqual(self.order.user, self.user)
示例5: test_05_set_order_to_session_works
def test_05_set_order_to_session_works(self):
self.create_fixtures()
setattr(self.request,'session', {})
add_order_to_request(self.request, self.order)
self.assertEqual(self.request.session['order_id'], self.order.id)
示例6: test_set_order_to_user_works
def test_set_order_to_user_works(self):
setattr(self.request, 'user', self.user)
add_order_to_request(self.request, self.order)
self.assertEqual(self.order.user, self.user)
示例7: test_set_order_to_session_works
def test_set_order_to_session_works(self):
setattr(self.request, 'session', {})
add_order_to_request(self.request, self.order)
self.assertEqual(self.request.session['order_id'], self.order.pk)
示例8: test_same_user_does_not_override
def test_same_user_does_not_override(self):
self.order.user = self.user
self.order.save()
setattr(self.request, "user", self.user)
add_order_to_request(self.request, self.order)
self.assertEqual(self.order.user, self.user)
示例9: test_set_order_to_session_works
def test_set_order_to_session_works(self):
setattr(self.request, "session", {})
add_order_to_request(self.request, self.order)
self.assertEqual(self.request.session["order_id"], self.order.id)