Spaces:
Sleeping
Sleeping
Update app/apps/emotion_recognition/views.py
Browse files
app/apps/emotion_recognition/views.py
CHANGED
@@ -6,6 +6,7 @@ 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_exempt
|
|
|
9 |
|
10 |
from rest_framework.views import APIView
|
11 |
from rest_framework.response import Response
|
@@ -56,7 +57,7 @@ def index(request):
|
|
56 |
# def real_time_stream(request):
|
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
|
@@ -73,7 +74,7 @@ class RecognitionUpdateView(UpdateView):
|
|
73 |
messages.success(self.request, 'Запись была успешно изменена!')
|
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"
|
@@ -86,7 +87,7 @@ class RecognitionDeleteView(DeleteView):
|
|
86 |
messages.success(self.request, 'Запись была успешно удалёна!')
|
87 |
return reverse_lazy('recognition:index')
|
88 |
|
89 |
-
|
90 |
class ImageProcessingView(APIView):
|
91 |
parser_classes = (MultiPartParser, FormParser) # Для обработки загруженных файлов
|
92 |
serializer_class = ImageSerializer
|
|
|
6 |
from django.contrib import messages
|
7 |
from django.urls import reverse_lazy
|
8 |
from django.views.decorators.csrf import csrf_exempt
|
9 |
+
from django.utils.decorators import method_decorator
|
10 |
|
11 |
from rest_framework.views import APIView
|
12 |
from rest_framework.response import Response
|
|
|
57 |
# def real_time_stream(request):
|
58 |
# return StreamingHttpResponse(emotionVideo(),content_type="multipart/x-mixed-replace;boundary=frame")
|
59 |
|
60 |
+
@method_decorator(csrf_exempt, name='dispatch')
|
61 |
class RecognitionUpdateView(UpdateView):
|
62 |
model = UserImageRecognition
|
63 |
form_class = RecognitionEditForm
|
|
|
74 |
messages.success(self.request, 'Запись была успешно изменена!')
|
75 |
return reverse_lazy('recognition:recognition_edit', args=(pk,))
|
76 |
|
77 |
+
@method_decorator(csrf_exempt, name='dispatch')
|
78 |
class RecognitionDeleteView(DeleteView):
|
79 |
model = UserImageRecognition
|
80 |
template_name = "recognition/recognition_delete.html"
|
|
|
87 |
messages.success(self.request, 'Запись была успешно удалёна!')
|
88 |
return reverse_lazy('recognition:index')
|
89 |
|
90 |
+
@method_decorator(csrf_exempt, name='dispatch')
|
91 |
class ImageProcessingView(APIView):
|
92 |
parser_classes = (MultiPartParser, FormParser) # Для обработки загруженных файлов
|
93 |
serializer_class = ImageSerializer
|