django_program.pretalx.sync¶
Synchronization service for importing Pretalx data into Django models.
Provides PretalxSyncService which orchestrates the import of speakers,
talks, and schedule slots from a Pretalx event into the corresponding Django
models. Each sync method is idempotent and uses bulk operations for
performance.
Classes
Synchronizes speaker, talk, and schedule data from Pretalx to Django models. |
- class django_program.pretalx.sync.PretalxSyncService[source]¶
Bases:
objectSynchronizes speaker, talk, and schedule data from Pretalx to Django models.
Builds a
PretalxClientfrom the conference’spretalx_event_slugand the global Pretalx configuration, then provides methods to sync each entity type individually or all at once.- Parameters:
conference (
Conference) – The conference whose Pretalx data should be synced.- Raises:
ValueError – If the conference has no
pretalx_event_slugconfigured.
- __init__(conference)[source]¶
Initialize the sync service for the given conference.
- Parameters:
conference (
Conference) – The conference whose Pretalx data should be synced.- Raises:
ValueError – If the conference has no
pretalx_event_slugconfigured.
- sync_rooms()[source]¶
Fetch rooms from Pretalx and upsert into the database.
- Return type:
- Returns:
The number of rooms synced.
- sync_speakers()[source]¶
Fetch speakers from Pretalx and upsert into the database.
Uses bulk operations for performance and delegates to
sync_speakers_iter()which yields progress dicts.- Return type:
- Returns:
The number of speakers synced.
- sync_talks()[source]¶
Fetch talks from Pretalx and upsert into the database.
Uses bulk operations for performance and delegates to
sync_talks_iter()which yields progress dicts.- Return type:
- Returns:
The number of talks synced.
- sync_schedule(*, allow_large_deletions=False)[source]¶
Fetch schedule slots from Pretalx and upsert into the database.
Slots that no longer appear in the Pretalx schedule are deleted after the sync completes.
- Parameters:
allow_large_deletions (
bool) – WhenTrue, bypasses the schedule-drop safety guard and permits large stale-slot deletions.- Return type:
- Returns:
A tuple of
(synced_count, unscheduled_count)where unscheduled_count is the number of talks that still have no scheduled slot after the sync.
- apply_type_defaults()[source]¶
Apply SubmissionTypeDefault records to unscheduled talks.
For each configured submission type default, finds talks of that type that have no room assigned and applies the default room and time slot.
- Return type:
- Returns:
The number of talks that were modified by type defaults.
- sync_all(*, allow_large_deletions=False)[source]¶
Run all sync operations in dependency order.
- Return type:
- Returns:
A mapping of entity type to the number synced. The
schedule_slotskey contains only the synced count;unscheduled_talksis added when any talks lack a slot.type_defaults_appliedis added when type defaults modify any talks.- Parameters:
allow_large_deletions (
bool)