ADD archivedet evaluvation
This commit is contained in:
@@ -267,6 +267,12 @@ class AutoEvaluationModel(AbstractBaseModel):
|
|||||||
choices=AutoEvaluationStatus.choices,
|
choices=AutoEvaluationStatus.choices,
|
||||||
default=AutoEvaluationStatus.CREATED,
|
default=AutoEvaluationStatus.CREATED,
|
||||||
)
|
)
|
||||||
|
is_archived = models.BooleanField(
|
||||||
|
verbose_name=_("is archived"),
|
||||||
|
default=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"Auto Evaluation {self.registration_number or self.pk}"
|
return f"Auto Evaluation {self.registration_number or self.pk}"
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ from .views import (
|
|||||||
DidoxCompanyInfoAPIView,
|
DidoxCompanyInfoAPIView,
|
||||||
TechPassportAPIView,
|
TechPassportAPIView,
|
||||||
EvaluationStatusChange,
|
EvaluationStatusChange,
|
||||||
AutoEvaluationRequestView
|
AutoEvaluationRequestView, GetArchivedEvaluation, GetEvaluation
|
||||||
)
|
)
|
||||||
|
|
||||||
router = DefaultRouter()
|
router = DefaultRouter()
|
||||||
@@ -78,4 +78,6 @@ urlpatterns = [
|
|||||||
name="evaluation-change-status"),
|
name="evaluation-change-status"),
|
||||||
path("auto-evaluation-request/", AutoEvaluationRequestView.as_view(),
|
path("auto-evaluation-request/", AutoEvaluationRequestView.as_view(),
|
||||||
name="evaluation-request-price-estimate"),
|
name="evaluation-request-price-estimate"),
|
||||||
|
path("archived-evaluvation/", GetArchivedEvaluation.as_view(),
|
||||||
|
name="archived-evaluation"),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from django_core.mixins import BaseViewSetMixin
|
|||||||
from django_filters.rest_framework import DjangoFilterBackend
|
from django_filters.rest_framework import DjangoFilterBackend
|
||||||
from drf_spectacular.utils import extend_schema, OpenApiParameter
|
from drf_spectacular.utils import extend_schema, OpenApiParameter
|
||||||
from rest_framework.filters import OrderingFilter, SearchFilter
|
from rest_framework.filters import OrderingFilter, SearchFilter
|
||||||
from rest_framework.generics import GenericAPIView
|
from rest_framework.generics import GenericAPIView, ListAPIView
|
||||||
from rest_framework.permissions import AllowAny, IsAuthenticated
|
from rest_framework.permissions import AllowAny, IsAuthenticated
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
@@ -159,16 +159,14 @@ class AutoEvaluationListAppraisersView(GenericAPIView):
|
|||||||
return Response({"error": str(e)}, status=500)
|
return Response({"error": str(e)}, status=500)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@extend_schema(
|
@extend_schema(
|
||||||
tags=["AutoEvaluation"],
|
tags=["AutoEvaluation"],
|
||||||
request=AutoEvaluationSerializer,
|
request=AutoEvaluationSerializer,
|
||||||
)
|
)
|
||||||
class AutoEvaluationRequestView(APIView):
|
class AutoEvaluationRequestView(APIView):
|
||||||
authentication_classes = []
|
authentication_classes = []
|
||||||
permission_classes = [AllowAny]
|
permission_classes = [AllowAny]
|
||||||
|
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
serializer = AutoEvaluationSerializer(data=request.data)
|
serializer = AutoEvaluationSerializer(data=request.data)
|
||||||
|
|
||||||
@@ -183,3 +181,15 @@ class AutoEvaluationRequestView(APIView):
|
|||||||
"data": response.json(),
|
"data": response.json(),
|
||||||
})
|
})
|
||||||
return Response({"error": serializer.errors}, status=400)
|
return Response({"error": serializer.errors}, status=400)
|
||||||
|
|
||||||
|
|
||||||
|
@extend_schema(tags=["AutoEvaluation"])
|
||||||
|
class GetArchivedEvaluation(ListAPIView):
|
||||||
|
authentication_classes = []
|
||||||
|
permission_classes = [IsAuthenticated]
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return AutoEvaluationModel.objects.filter(is_archived=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user