def get(self, request): url = request.GET.get('url') name = request.GET.get('name') downloader = DownloadManager(settings.DOWNLOAD_ROOT, settings.PIDFILE_FILENAME, settings.ARIA2_CONF_FILENAME) downloader.launch_if_required() gid = downloader.add_download(url) sync_downloads() from django.contrib import messages messages.success(request, "Successfully added '%s'." % name) return HttpResponseRedirect(redirect_to='/search/')
def get_context_data(self, **kwargs): context = super(DownloadItemsView, self).get_context_data(**kwargs) sync_downloads() return context