pretalx / pretalx

Conference planning tool: CfP, scheduling, speaker management
https://pretalx.com
Apache License 2.0
711 stars 200 forks source link

Question: How to combine instances #712

Closed vmx closed 5 years ago

vmx commented 5 years ago

This is really just a question, but I thought it might be interesting for others as well, hence I ask it here in an issue.

We used pretalx in probably an uncommon way. We had several conferences for different tracks, this way we were able to have a different Call for papers, deadlines etc.

Now we would like to combine those two conferences into a single instance to do the scheduling as a single conference. Best would also be to put them in individual tracks (one track for each conference).

What would be the best way of doing this?

I don't ask for any properly supported way of doing this, it's more of a "how would you do this one-off operation"? Any hints are welcome before I start hacking something together.

rixx commented 5 years ago

I'd write a shell method to do this, to be honest, which would loop over the submissions and change their event, submission type, and track, as well as the event associated with speaker profiles.

I don't anticipate support for subevents to land in pretalx any time soon, unless it comes as a commissioned feature.

vmx commented 5 years ago

Would you do this directly on the database or through Python (or is there even an API)?

rixx commented 5 years ago

I would do this in Python.

vmx commented 5 years ago

I moved the talks as suggested. Once thing I missed on the first try was, that a schedule is associated with a certain event. And all talks within an event are automatically associated with a schedule even if you haven't done any scheduling yet. This means that you also need the schedule assigned to the talk.

Here's the script I've used which is instance specific, but it might be helpful to others trying to do something similar. You can run it in your virtualenv via python -m pretalx shell < that-script.py.

from pretalx.event.models import Event
from pretalx.schedule.models import Schedule, TalkSlot
from pretalx.submission.models import Submission, SubmissionType, Track

# Assign general track to all submissions to the general conference
generalConf = Event.objects.get(pk=1)
generalTrack = Track.objects.get(pk=1)
Submission.objects.select_related().filter(event=generalConf).update(track=generalTrack)

# Move the academic conference talks to the general conference and assign the
# academic track
academicConf = Event.objects.get(pk=2)
academicTrack = Track.objects.get(pk=2)
Submission.objects.select_related().filter(event=academicConf).update(event=generalConf, track=academicTrack)

# Move academic talk type from academic conference to the general conference
SubmissionType.objects.filter(pk=4).update(event_id=generalConf)

# Move all talks from acadmic conference schedule to the general conference
# schedule (that's needed even if there wasn't anything scheduled yet
generalSchedule = Schedule.objects.get(event_id=generalConf)
academicSchedule = Schedule.objects.get(event_id=academicConf)
TalkSlot.objects.select_related().filter(schedule=academicSchedule).update(schedule=generalSchedule)

print('done.')