forked from CGM_Public/pretix_original
Fix critical error in previous commit
This commit is contained in:
@@ -244,13 +244,14 @@ class SubEventViewSet(ConditionalListView, viewsets.ModelViewSet):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def perform_update(self, serializer):
|
def perform_update(self, serializer):
|
||||||
if serializer.data == self.get_serializer(instance=serializer.instance).data:
|
original_data = self.get_serializer(instance=serializer.instance).data
|
||||||
|
super().perform_update(serializer)
|
||||||
|
|
||||||
|
if serializer.data == original_data:
|
||||||
# Performance optimization: If nothing was changed, we do not need to save or log anything.
|
# Performance optimization: If nothing was changed, we do not need to save or log anything.
|
||||||
# This costs us a few cycles on save, but avoids thousands of lines in our log.
|
# This costs us a few cycles on save, but avoids thousands of lines in our log.
|
||||||
return
|
return
|
||||||
|
|
||||||
super().perform_update(serializer)
|
|
||||||
|
|
||||||
serializer.instance.log_action(
|
serializer.instance.log_action(
|
||||||
'pretix.subevent.changed',
|
'pretix.subevent.changed',
|
||||||
user=self.request.user,
|
user=self.request.user,
|
||||||
|
|||||||
@@ -65,11 +65,14 @@ class ItemViewSet(ConditionalListView, viewsets.ModelViewSet):
|
|||||||
return ctx
|
return ctx
|
||||||
|
|
||||||
def perform_update(self, serializer):
|
def perform_update(self, serializer):
|
||||||
if serializer.data == self.get_serializer(instance=serializer.instance).data:
|
original_data = self.get_serializer(instance=serializer.instance).data
|
||||||
|
|
||||||
|
serializer.save(event=self.request.event)
|
||||||
|
|
||||||
|
if serializer.data == original_data:
|
||||||
# Performance optimization: If nothing was changed, we do not need to save or log anything.
|
# Performance optimization: If nothing was changed, we do not need to save or log anything.
|
||||||
# This costs us a few cycles on save, but avoids thousands of lines in our log.
|
# This costs us a few cycles on save, but avoids thousands of lines in our log.
|
||||||
return
|
return
|
||||||
serializer.save(event=self.request.event)
|
|
||||||
serializer.instance.log_action(
|
serializer.instance.log_action(
|
||||||
'pretix.event.item.changed',
|
'pretix.event.item.changed',
|
||||||
user=self.request.user,
|
user=self.request.user,
|
||||||
@@ -456,14 +459,17 @@ class QuotaViewSet(ConditionalListView, viewsets.ModelViewSet):
|
|||||||
return ctx
|
return ctx
|
||||||
|
|
||||||
def perform_update(self, serializer):
|
def perform_update(self, serializer):
|
||||||
if serializer.data == self.get_serializer(instance=serializer.instance).data:
|
original_data = self.get_serializer(instance=serializer.instance).data
|
||||||
# Performance optimization: If nothing was changed, we do not need to save or log anything.
|
|
||||||
# This costs us a few cycles on save, but avoids thousands of lines in our log.
|
|
||||||
return
|
|
||||||
|
|
||||||
current_subevent = serializer.instance.subevent
|
current_subevent = serializer.instance.subevent
|
||||||
serializer.save(event=self.request.event)
|
serializer.save(event=self.request.event)
|
||||||
request_subevent = serializer.instance.subevent
|
request_subevent = serializer.instance.subevent
|
||||||
|
|
||||||
|
if serializer.data == original_data:
|
||||||
|
# Performance optimization: If nothing was changed, we do not need to save or log anything.
|
||||||
|
# This costs us a few cycles on save, but avoids thousands of lines in our log.
|
||||||
|
return
|
||||||
|
|
||||||
serializer.instance.log_action(
|
serializer.instance.log_action(
|
||||||
'pretix.event.quota.changed',
|
'pretix.event.quota.changed',
|
||||||
user=self.request.user,
|
user=self.request.user,
|
||||||
|
|||||||
Reference in New Issue
Block a user