Allow syncing a single channel

This commit is contained in:
Jacob Mansfield [root@Helix]
2019-11-22 17:11:52 +00:00
parent 794b9bd42d
commit 85092935a6
4 changed files with 24 additions and 3 deletions

View File

@ -3,12 +3,15 @@ from django.http import JsonResponse
from django.views.generic import View
from YtManagerApp.management.jobs.synchronize import SynchronizeJob
from YtManagerApp.models import Video
from YtManagerApp.models import Video, Subscription
class SyncNowView(LoginRequiredMixin, View):
def post(self, *args, **kwargs):
SynchronizeJob.schedule_now()
if 'pk' in kwargs:
SynchronizeJob.schedule_now_for_subscription(Subscription.objects.get(id=kwargs['pk']))
else:
SynchronizeJob.schedule_now()
return JsonResponse({
'success': True
})