def do_copyedit_add_file(request, copyedit_id): """ Allows a copyeditor to upload a new file and associate it with the article, only if the assignment is not complete. :param request: HttpRequest :param copyedit_id: a CopyeditAssignment PK :return: HttpResponse object """ copyedit = get_object_or_404(models.CopyeditAssignment, Q(copyeditor_completed__isnull=True) | Q(copyedit_reopened__isnull=False), copyedit_reopened_complete__isnull=True, pk=copyedit_id, decision='accept') errors = None if request.POST: errors = logic.handle_file_post(request, copyedit) if not errors: return redirect( reverse('do_copyedit', kwargs={'copyedit_id': copyedit.id})) template = 'copyediting/upload_file.html' context = { 'copyedit': copyedit, 'errors': errors, } return render(request, template, context)
def do_copyedit_add_file(request, copyedit_id): copyedit = get_object_or_404(models.CopyeditAssignment, Q(copyeditor_completed__isnull=True) | Q(copyedit_reopened__isnull=False), copyedit_reopened_complete__isnull=True, pk=copyedit_id, decision='accept') errors = None if request.POST: errors = logic.handle_file_post(request, copyedit) if not errors: return redirect(reverse('do_copyedit', kwargs={'copyedit_id': copyedit.id})) template = 'copyediting/upload_file.html' context = { 'copyedit': copyedit, 'errors': errors, } return render(request, template, context)