Jonas Havelka
2 weeks ago
4 changed files with 64 additions and 2 deletions
@ -0,0 +1,7 @@ |
|||
from django.urls import path |
|||
from personalni.utils import org_required |
|||
from . import views |
|||
|
|||
urlpatterns = [ |
|||
path('korektury/api/<int:pdf_id>/stav', org_required(views.korektury_stav_view), name='korektury_api_pdf_stav'), |
|||
] |
@ -0,0 +1,20 @@ |
|||
from django.http import HttpResponseForbidden, JsonResponse |
|||
from django.shortcuts import get_object_or_404 |
|||
from django.views.decorators.csrf import csrf_exempt |
|||
|
|||
from rest_framework import serializers |
|||
|
|||
from korektury.utils import send_email_notification_komentar |
|||
from korektury.models import Oprava, KorekturovanePDF, Komentar |
|||
from personalni.models import Organizator, Osoba |
|||
|
|||
|
|||
def korektury_stav_view(request, pdf_id: int, **kwargs): |
|||
q = request.POST |
|||
pdf = get_object_or_404(KorekturovanePDF, id=pdf_id) |
|||
status = q.get('state') |
|||
if status is not None: |
|||
assert status in KorekturovanePDF.STATUS.values |
|||
pdf.status = status |
|||
pdf.save() |
|||
return JsonResponse({'status': pdf.status}) |
Loading…
Reference in new issue