mirror of
https://framagit.org/la-chariotte/la-chariotte.git
synced 2025-05-04 12:51:50 +02:00
Rename method 'create_ordered_item method' to 'order_item'
This commit is contained in:
parent
523c8f5cfa
commit
da4d4d524c
3 changed files with 6 additions and 6 deletions
|
@ -123,7 +123,7 @@ class Order(models.Model):
|
||||||
f" {self.grouped_order.code}"
|
f" {self.grouped_order.code}"
|
||||||
)
|
)
|
||||||
|
|
||||||
def create_ordered_item(self, nb, item):
|
def order_item(self, nb, item):
|
||||||
"""Create an OrderItem instance and update counters/price accordingly"""
|
"""Create an OrderItem instance and update counters/price accordingly"""
|
||||||
self.ordered_items.add(OrderedItem.objects.create(nb=nb, order=self, item=item))
|
self.ordered_items.add(OrderedItem.objects.create(nb=nb, order=self, item=item))
|
||||||
item.ordered_nb += nb
|
item.ordered_nb += nb
|
||||||
|
|
|
@ -66,7 +66,7 @@ def place_order(request, code):
|
||||||
if error_message:
|
if error_message:
|
||||||
break # stop creating items if there is an error
|
break # stop creating items if there is an error
|
||||||
if quantity > 0:
|
if quantity > 0:
|
||||||
order.create_ordered_item(nb=quantity, item=item)
|
order.order_item(nb=quantity, item=item)
|
||||||
|
|
||||||
# Redisplay the form with error messages if there is an error
|
# Redisplay the form with error messages if there is an error
|
||||||
if error_message:
|
if error_message:
|
||||||
|
|
|
@ -40,8 +40,8 @@ def order_items_in_grouped_order(grouped_order):
|
||||||
order = grouped_order.order_set.create(author=author_1)
|
order = grouped_order.order_set.create(author=author_1)
|
||||||
order_2 = grouped_order.order_set.create(author=author_2)
|
order_2 = grouped_order.order_set.create(author=author_2)
|
||||||
order_3 = grouped_order.order_set.create(author=author_3)
|
order_3 = grouped_order.order_set.create(author=author_3)
|
||||||
order.create_ordered_item(item=item_1, nb=3)
|
order.order_item(item=item_1, nb=3)
|
||||||
order.create_ordered_item(item=item_2, nb=2)
|
order.order_item(item=item_2, nb=2)
|
||||||
order_2.create_ordered_item(item=item_1, nb=1)
|
order_2.order_item(item=item_1, nb=1)
|
||||||
order_3.create_ordered_item(item=item_2, nb=1)
|
order_3.order_item(item=item_2, nb=1)
|
||||||
return order
|
return order
|
||||||
|
|
Loading…
Reference in a new issue