Orders: Fix N+1 query issues on order detail and change page (#6390)

* rders: Fix N+1 query issues on order detail and change page

There is one I couldn't fix: Loading the list of tax rules for every
select box on the OrderChange page. Unfortunately, Django has a
cache-breaking .all() in ModelChoiceField and that would need nasty
patching that didn't feel worth it

* Fix isort

* Fix N+1 query in gate call

* Fix leftovers

* Add local cache for objects referenced in log entries

* Update src/pretix/control/views/orders.py
This commit is contained in:
Raphael Michel
2026-07-28 09:08:14 +02:00
committed by GitHub
parent 55b6887c5e
commit 163cf85c86
4 changed files with 53 additions and 28 deletions
+1 -3
View File
@@ -562,9 +562,7 @@ class OrderPositionChangeForm(forms.Form):
if instance.addon_to_id:
del self.fields['operation_split']
if not instance.seat and not (
instance.item.seat_category_mappings.filter(subevent=instance.subevent).exists()
):
if not instance.seat and not instance._seat_allowed:
del self.fields['seat']
choices = [