Sort positions by ID

This commit is contained in:
Raphael Michel
2016-12-21 19:00:23 +01:00
parent 18c24623d7
commit 0dc3f30791
2 changed files with 3 additions and 3 deletions

View File

@@ -163,7 +163,7 @@ class OrderDetail(OrderView):
'item', 'variation'
).prefetch_related(
'item__questions', 'answers', 'answers__question'
)
).order_by('positionid')
positions = []
for p in cartpos:

View File

@@ -40,10 +40,10 @@ class CartMixin:
# Django is unable to join related models in a .values() query
def keyfunc(pos):
if downloads:
return pos.id, 0, 0, 0, 0
return pos.positionid, 0, 0, 0, 0
if answers and ((pos.item.admission and self.request.event.settings.attendee_names_asked)
or pos.item.questions.all()):
return pos.id, 0, 0, 0, 0
return pos.positionid, 0, 0, 0, 0
return 0, pos.item_id, pos.variation_id, pos.price, (pos.voucher_id or 0)
positions = []