Import large package lazily to speed up startup (#5636)

* Import large package lazily to speed up startup

* Make all jsonschema imports lazy
This commit is contained in:
Raphael Michel
2025-12-09 09:52:53 +01:00
committed by GitHub
parent f214edaf34
commit b895d9bbca
10 changed files with 41 additions and 11 deletions

View File

@@ -22,7 +22,6 @@
import json
from collections import namedtuple
import jsonschema
from django.contrib.staticfiles import finders
from django.core.exceptions import ValidationError
from django.db import models
@@ -38,6 +37,8 @@ from pretix.base.models import Event, Item, LoggedModel, Organizer, SubEvent
@deconstructible
class SeatingPlanLayoutValidator:
def __call__(self, value):
import jsonschema
if not isinstance(value, dict):
try:
val = json.loads(value)