ADD archivedet evaluvation
This commit is contained in:
@@ -267,6 +267,12 @@ class AutoEvaluationModel(AbstractBaseModel):
|
||||
choices=AutoEvaluationStatus.choices,
|
||||
default=AutoEvaluationStatus.CREATED,
|
||||
)
|
||||
is_archived = models.BooleanField(
|
||||
verbose_name=_("is archived"),
|
||||
default=False,
|
||||
)
|
||||
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return f"Auto Evaluation {self.registration_number or self.pk}"
|
||||
|
||||
@@ -29,7 +29,7 @@ from .views import (
|
||||
DidoxCompanyInfoAPIView,
|
||||
TechPassportAPIView,
|
||||
EvaluationStatusChange,
|
||||
AutoEvaluationRequestView
|
||||
AutoEvaluationRequestView, GetArchivedEvaluation, GetEvaluation
|
||||
)
|
||||
|
||||
router = DefaultRouter()
|
||||
@@ -78,4 +78,6 @@ urlpatterns = [
|
||||
name="evaluation-change-status"),
|
||||
path("auto-evaluation-request/", AutoEvaluationRequestView.as_view(),
|
||||
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 drf_spectacular.utils import extend_schema, OpenApiParameter
|
||||
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.response import Response
|
||||
from rest_framework.views import APIView
|
||||
@@ -159,16 +159,14 @@ class AutoEvaluationListAppraisersView(GenericAPIView):
|
||||
return Response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
|
||||
@extend_schema(
|
||||
tags=["AutoEvaluation"],
|
||||
request=AutoEvaluationSerializer,
|
||||
)
|
||||
tags=["AutoEvaluation"],
|
||||
request=AutoEvaluationSerializer,
|
||||
)
|
||||
class AutoEvaluationRequestView(APIView):
|
||||
authentication_classes = []
|
||||
permission_classes = [AllowAny]
|
||||
|
||||
|
||||
def post(self, request):
|
||||
serializer = AutoEvaluationSerializer(data=request.data)
|
||||
|
||||
@@ -183,3 +181,15 @@ class AutoEvaluationRequestView(APIView):
|
||||
"data": response.json(),
|
||||
})
|
||||
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