[ADD] FACEDETECTION: Employee price allocate view
This commit is contained in:
@@ -5,6 +5,9 @@ from django.db import models
|
|||||||
from django.db.models.signals import post_delete
|
from django.db.models.signals import post_delete
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
|
|
||||||
|
from employee.models import Employee
|
||||||
|
from horilla.models import HorillaModel, upload_path
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
||||||
|
|
||||||
@@ -44,9 +47,13 @@ class FaceDetection(models.Model):
|
|||||||
|
|
||||||
class EmployeeFaceDetection(models.Model):
|
class EmployeeFaceDetection(models.Model):
|
||||||
employee_id = models.OneToOneField(
|
employee_id = models.OneToOneField(
|
||||||
"employee.Employee", related_name="face_detection", on_delete=models.CASCADE
|
Employee, related_name="face_detection", on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
image = models.ImageField(
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
upload_to=upload_path,
|
||||||
)
|
)
|
||||||
image = models.ImageField()
|
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_delete, sender=EmployeeFaceDetection)
|
@receiver(post_delete, sender=EmployeeFaceDetection)
|
||||||
|
|||||||
@@ -101,6 +101,11 @@ class EmployeeFaceDetectionGetPostAPIView(APIView):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise serializers.ValidationError(e)
|
raise serializers.ValidationError(e)
|
||||||
|
|
||||||
|
def get(self, request):
|
||||||
|
facedetection = self.get_facedetection(request)
|
||||||
|
serializer = EmployeeFaceDetectionSerializer(facedetection)
|
||||||
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
if self.get_facedetection(request).start:
|
if self.get_facedetection(request).start:
|
||||||
employee_id = request.user.employee_get.id
|
employee_id = request.user.employee_get.id
|
||||||
|
|||||||
Reference in New Issue
Block a user