Various fixes

This commit is contained in:
2026-04-08 22:09:51 +02:00
parent 149a488795
commit 6bd9119093
13 changed files with 1613 additions and 152 deletions

View File

@@ -1,9 +1,11 @@
from django.core.management.base import NoArgsCommand
from django.core.management.base import BaseCommand
from eventplanner_gcal.google_sync import checkGCalSubscription
from eventplanner_gcal.google_sync import check_gcal_subscription
class Command(NoArgsCommand):
class Command(BaseCommand):
help = 'Checks if the GCal notification channel is still active'
def handle_noargs(self, **options):
print ( "Checking Subscription")
checkGCalSubscription()
def handle(self, *args, **options):
self.stdout.write('Checking Subscription')
check_gcal_subscription()

View File

@@ -1,9 +1,12 @@
from django.core.management.base import NoArgsCommand
from eventplanner_gcal.google_sync import deleteAllGCalEvents
from django.core.management.base import BaseCommand
class Command(NoArgsCommand):
from eventplanner_gcal.google_sync import delete_all_gcal_events
class Command(BaseCommand):
help = 'Delete all events in the google calendar created by this app'
def handle_noargs(self, **options):
print ("Deleting all GCal Events.")
nrOfDeletedEvents = deleteAllGCalEvents()
print ("Deleted %d events. To Restore them from local database run gcal_sync" % (nrOfDeletedEvents, ) )
def handle(self, *args, **options):
self.stdout.write('Deleting all GCal Events.')
nr_deleted = delete_all_gcal_events()
self.stdout.write(f'Deleted {nr_deleted} events. To restore them run gcal_sync')

View File

@@ -1,8 +1,10 @@
from django.core.management.base import NoArgsCommand
from django.core.management.base import BaseCommand
from eventplanner_gcal.google_sync import stopAllGCalSubscriptions
from eventplanner_gcal.google_sync import stop_all_gcal_subscriptions
class Command(NoArgsCommand):
class Command(BaseCommand):
help = 'Stops all GCal subscriptions'
def handle_noargs(self, **options):
stopAllGCalSubscriptions()
def handle(self, *args, **options):
stop_all_gcal_subscriptions()

View File

@@ -1,10 +1,12 @@
from django.core.management.base import NoArgsCommand
from django.core.management.base import BaseCommand
from eventplanner_gcal.google_sync import syncFromLocalToGoogle
from eventplanner_gcal.google_sync import sync_from_local_to_google
class Command(NoArgsCommand):
class Command(BaseCommand):
help = 'Synchronize Google Calendar with locally stored Events'
def handle_noargs(self, **options):
print ( "Running Sync")
created, deleted = syncFromLocalToGoogle()
print ( "Created %d and deleted %d events" % (created,deleted) )
def handle(self, *args, **options):
self.stdout.write('Running Sync')
created, deleted = sync_from_local_to_google()
self.stdout.write(f'Created {created} and deleted {deleted} events')