From 22f47d4fcd3849e68f24f9a1d5570515d0feb4c3 Mon Sep 17 00:00:00 2001 From: Marc Date: Tue, 16 Sep 2014 14:42:32 +0000 Subject: [PATCH] Fix on group_by dict based reimplemenattion --- orchestra/apps/orders/models.py | 2 +- orchestra/models/queryset.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/orchestra/apps/orders/models.py b/orchestra/apps/orders/models.py index a4966ac9..172deb32 100644 --- a/orchestra/apps/orders/models.py +++ b/orchestra/apps/orders/models.py @@ -313,7 +313,7 @@ class OrderQuerySet(models.QuerySet): commit = options.get('commit', True) for account, services in qs.group_by('account', 'service').iteritems(): bill_lines = [] - for service, orders in services: + for service, orders in services.iteritems(): lines = service.handler.generate_bill_lines(orders, account, **options) bill_lines.extend(lines) if commit: diff --git a/orchestra/models/queryset.py b/orchestra/models/queryset.py index aff7a77c..186dd181 100644 --- a/orchestra/models/queryset.py +++ b/orchestra/models/queryset.py @@ -21,6 +21,7 @@ def group_by(qset, *fields): group = group[current] except KeyError: group[current] = OrderedDict() + group = group[current] else: try: group[current].append(obj)