ADD archivedet evaluvation

This commit is contained in:
Shaxobff
2026-04-24 11:22:58 +05:00
parent af559dadda
commit 82489cf64c
3 changed files with 25 additions and 7 deletions

View File

@@ -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}"

View File

@@ -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"),
]

View File

@@ -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)