Skip to content

Commit

Permalink
Add manage command to update events
Browse files Browse the repository at this point in the history
  • Loading branch information
rixx committed Dec 27, 2021
1 parent 2b9bca8 commit 01895ae
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Empty file.
Empty file.
26 changes: 26 additions & 0 deletions pretalx_downstream/management/commands/downstream_pull.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from django.core.management.base import BaseCommand
from django.db import transaction
from django_scopes import scope
from pretalx.event.models import Event

from pretalx_downstream.tasks import task_refresh_upstream_schedule


class Command(BaseCommand):
help = "Pull an event's upstream data"

def add_arguments(self, parser):
parser.add_argument("--event", type=str, help="Slug of the event to be used")
parser.add_argument("--sync", action="store_true", help="Run synchronously")

@transaction.atomic
def handle(self, *args, **options):
event_slug = options.get("event")
sync = options.get("sync")

event = Event.objects.get(slug=event_slug)
with scope(event=event):
if sync:
task_refresh_upstream_schedule(event_slug)
else:
task_refresh_upstream_schedule.apply_async(args=(event_slug,))

0 comments on commit 01895ae

Please sign in to comment.