forked from CGM_Public/pretix_original
Fix a severe bug in VariationField
This commit is contained in:
@@ -649,12 +649,12 @@ class PropertyValue(Versionable):
|
|||||||
if self.prop:
|
if self.prop:
|
||||||
self.prop.event.get_cache().clear()
|
self.prop.event.get_cache().clear()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def sortkey(self):
|
||||||
|
return self.position, self.pk
|
||||||
|
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
if self.position < other.position:
|
return self.sortkey < other.sortkey
|
||||||
return True
|
|
||||||
if self.position == other.position:
|
|
||||||
return self.pk < other.pk
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
class Question(Versionable):
|
class Question(Versionable):
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ class VariationsFieldRenderer(forms.widgets.CheckboxFieldRenderer):
|
|||||||
def sort(v):
|
def sort(v):
|
||||||
# Given a list of variations, this will sort them by their position
|
# Given a list of variations, this will sort them by their position
|
||||||
# on the x-axis
|
# on the x-axis
|
||||||
return v[prop2.identity].identity
|
return v[prop2.identity].sortkey
|
||||||
|
|
||||||
# We now iterate over the cartesian product of all the other
|
# We now iterate over the cartesian product of all the other
|
||||||
# properties which are NOT on the axes of the grid because we
|
# properties which are NOT on the axes of the grid because we
|
||||||
|
|||||||
@@ -765,7 +765,7 @@ class ItemVariations(ItemDetailMixin, EventPermissionRequiredMixin, TemplateView
|
|||||||
def sort(v):
|
def sort(v):
|
||||||
# Given a list of variations, this will sort them by their position
|
# Given a list of variations, this will sort them by their position
|
||||||
# on the x-axis
|
# on the x-axis
|
||||||
return v[prop2.identity].identity
|
return v[prop2.identity].sortkey
|
||||||
|
|
||||||
# We now iterate over the cartesian product of all the other
|
# We now iterate over the cartesian product of all the other
|
||||||
# properties which are NOT on the axes of the grid because we
|
# properties which are NOT on the axes of the grid because we
|
||||||
|
|||||||
Reference in New Issue
Block a user