Spaces:
Sleeping
Sleeping
Update app/apps/emotion_recognition/views.py
Browse files
app/apps/emotion_recognition/views.py
CHANGED
@@ -5,6 +5,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
|
5 |
from django.views.generic import UpdateView, DeleteView
|
6 |
from django.contrib import messages
|
7 |
from django.urls import reverse_lazy
|
|
|
8 |
|
9 |
from rest_framework.views import APIView
|
10 |
from rest_framework.response import Response
|
@@ -18,7 +19,7 @@ from .tasks import proccess_uploaded_image, process_image_from_api, convert_imag
|
|
18 |
from .forms import RecognitionEditForm
|
19 |
|
20 |
|
21 |
-
|
22 |
@require_http_methods(['GET', 'POST'])
|
23 |
def index(request):
|
24 |
try:
|
@@ -56,7 +57,7 @@ def index(request):
|
|
56 |
# return StreamingHttpResponse(emotionVideo(),content_type="multipart/x-mixed-replace;boundary=frame")
|
57 |
|
58 |
|
59 |
-
class RecognitionUpdateView(
|
60 |
model = UserImageRecognition
|
61 |
form_class = RecognitionEditForm
|
62 |
template_name = "recognition/recognition_edit.html"
|
@@ -73,7 +74,7 @@ class RecognitionUpdateView(LoginRequiredMixin, UpdateView):
|
|
73 |
return reverse_lazy('recognition:recognition_edit', args=(pk,))
|
74 |
|
75 |
|
76 |
-
class RecognitionDeleteView(
|
77 |
model = UserImageRecognition
|
78 |
template_name = "recognition/recognition_delete.html"
|
79 |
|
|
|
5 |
from django.views.generic import UpdateView, DeleteView
|
6 |
from django.contrib import messages
|
7 |
from django.urls import reverse_lazy
|
8 |
+
from django.views.decorators.csrf import csrf_protect
|
9 |
|
10 |
from rest_framework.views import APIView
|
11 |
from rest_framework.response import Response
|
|
|
19 |
from .forms import RecognitionEditForm
|
20 |
|
21 |
|
22 |
+
@csrf_protect
|
23 |
@require_http_methods(['GET', 'POST'])
|
24 |
def index(request):
|
25 |
try:
|
|
|
57 |
# return StreamingHttpResponse(emotionVideo(),content_type="multipart/x-mixed-replace;boundary=frame")
|
58 |
|
59 |
|
60 |
+
class RecognitionUpdateView(UpdateView):
|
61 |
model = UserImageRecognition
|
62 |
form_class = RecognitionEditForm
|
63 |
template_name = "recognition/recognition_edit.html"
|
|
|
74 |
return reverse_lazy('recognition:recognition_edit', args=(pk,))
|
75 |
|
76 |
|
77 |
+
class RecognitionDeleteView(DeleteView):
|
78 |
model = UserImageRecognition
|
79 |
template_name = "recognition/recognition_delete.html"
|
80 |
|