X-Git-Url: https://git.mdrn.pl/audio.git/blobdiff_plain/ac39503a5a9a16c1098e65ee16a866cf8eb19a8f..09c7e92db4f6c0e94f8686a94bbfaa6896b0290c:/src/archive/views.py?ds=sidebyside diff --git a/src/archive/views.py b/src/archive/views.py index 31ea9c3..55f4f07 100644 --- a/src/archive/views.py +++ b/src/archive/views.py @@ -65,7 +65,7 @@ def file_new(request, filename): d[tag] = None if not request.POST: - form = AudiobookForm(d) + form = AudiobookForm(initial=d) return render(request, "archive/file_new.html", locals()) @@ -171,8 +171,8 @@ def publish(request, aid, publish=True): audiobook.mp3_status = audiobook.ogg_status = status.WAITING audiobook.save() # isn't there a race here? - audiobook.mp3_task = tasks.Mp3Task.delay(aid, publish).task_id - audiobook.ogg_task = tasks.OggTask.delay(aid, publish).task_id + audiobook.mp3_task = tasks.Mp3Task.delay(request.user.id, aid, publish).task_id + audiobook.ogg_task = tasks.OggTask.delay(request.user.id, aid, publish).task_id audiobook.save() return redirect(file_managed, aid) @@ -258,6 +258,10 @@ def file_managed(request, id): tags = {} form = AudiobookForm(instance=audiobook) + user_can_publish = ( + request.user.is_authenticated and + request.user.oauthconnection_set.filter(access=True).exists()) + return render(request, "archive/file_managed.html", locals())