mirror of
https://github.com/pretix/pretix.git
synced 2025-12-05 21:32:28 +00:00
Scheduled exports: Fix missing event context, fix form initial
This commit is contained in:
@@ -245,6 +245,7 @@ def _run_scheduled_export(schedule, context: Union[Event, Organizer], exporter,
|
||||
subject=schedule.mail_subject,
|
||||
template=LazyI18nString(schedule.mail_template),
|
||||
context=get_email_context(event=context) if isinstance(context, Event) else {},
|
||||
event=context if isinstance(context, Event) else None,
|
||||
organizer=context.organizer if isinstance(context, Event) else context,
|
||||
locale=schedule.locale,
|
||||
attach_cached_files=[file],
|
||||
|
||||
@@ -2256,6 +2256,15 @@ class ExportMixin:
|
||||
|
||||
if self.scheduled:
|
||||
initial = self.scheduled.export_form_data
|
||||
|
||||
test_form = ExporterForm(data=self.request.GET, prefix=ex.identifier)
|
||||
test_form.fields = ex.export_form_fields
|
||||
for k in initial:
|
||||
if initial[k] and k in test_form.fields:
|
||||
try:
|
||||
initial[k] = test_form.fields[k].to_python(initial[k])
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
# Use form parse cycle to generate useful defaults
|
||||
test_form = ExporterForm(data=self.request.GET, prefix=ex.identifier)
|
||||
|
||||
@@ -1526,6 +1526,15 @@ class ExportMixin:
|
||||
continue
|
||||
if self.scheduled:
|
||||
initial = self.scheduled.export_form_data
|
||||
|
||||
test_form = ExporterForm(data=self.request.GET, prefix=ex.identifier)
|
||||
test_form.fields = ex.export_form_fields
|
||||
for k in initial:
|
||||
if initial[k] and k in test_form.fields:
|
||||
try:
|
||||
initial[k] = test_form.fields[k].to_python(initial[k])
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
# Use form parse cycle to generate useful defaults
|
||||
test_form = ExporterForm(data=self.request.GET, prefix=ex.identifier)
|
||||
|
||||
Reference in New Issue
Block a user