forked from CGM_Public/pretix_original
get_all_variations: return an empty dict in the list if there are no
properties
This commit is contained in:
@@ -555,6 +555,7 @@ class Item(models.Model):
|
|||||||
result = []
|
result = []
|
||||||
for comb in product(*[prop.values.all() for prop in all_properties]):
|
for comb in product(*[prop.values.all() for prop in all_properties]):
|
||||||
if len(comb) == 0:
|
if len(comb) == 0:
|
||||||
|
result.append({})
|
||||||
continue
|
continue
|
||||||
key = []
|
key = []
|
||||||
var = {}
|
var = {}
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ class ItemVariationsTest(TestCase):
|
|||||||
|
|
||||||
# No properties available
|
# No properties available
|
||||||
v = i.get_all_variations()
|
v = i.get_all_variations()
|
||||||
self.assertEqual(len(v), 0)
|
self.assertEqual(len(v), 1)
|
||||||
|
self.assertEqual(v[0], {})
|
||||||
|
|
||||||
# One property, no variations
|
# One property, no variations
|
||||||
p = Property.objects.get(event=e, name='Size')
|
p = Property.objects.get(event=e, name='Size')
|
||||||
|
|||||||
Reference in New Issue
Block a user