/api/v1/admin-user/list/ edit va post
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import re
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
from rest_framework import serializers
|
||||
|
||||
@@ -358,8 +359,12 @@ class AutoEvaluationAppraisersSerializer(serializers.Serializer):
|
||||
data['users'] = users
|
||||
return data
|
||||
|
||||
|
||||
class AutoEvaluationSerializer(ModelSerializer):
|
||||
class Meta:
|
||||
model = AutoEvaluationModel
|
||||
fields = ("brand", "brand_model", "year", "color", "transmission", "condition", "fuel_type", "mileage")
|
||||
class AutoEvaluationSerializer(serializers.Serializer):
|
||||
brand = serializers.CharField()
|
||||
brand_model = serializers.CharField()
|
||||
year = serializers.CharField()
|
||||
color = serializers.CharField()
|
||||
transmission = serializers.CharField()
|
||||
condition = serializers.CharField()
|
||||
fuel_type = serializers.CharField()
|
||||
mileage = serializers.CharField()
|
||||
@@ -54,7 +54,6 @@ router.register("vehicle", VehicleView, basename="vehicle")
|
||||
router.register("valuation", ValuationView, basename="valuation")
|
||||
router.register("property-owner", PropertyOwnerView, basename="property-owner")
|
||||
router.register("customer", CustomerView, basename="customer")
|
||||
router.register("auto-evaluation-request", AutoEvaluationRequestView, basename="auto")
|
||||
urlpatterns = [
|
||||
path("", include(router.urls)),
|
||||
path("auto-evaluation/appraisers/", include(
|
||||
@@ -77,4 +76,6 @@ urlpatterns = [
|
||||
),
|
||||
path("evaluation-request/<int:pk>/change-status/", EvaluationStatusChange.as_view(),
|
||||
name="evaluation-change-status"),
|
||||
path("auto-evaluation-request/", AutoEvaluationRequestView.as_view(),
|
||||
name="evaluation-request-price-estimate"),
|
||||
]
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import requests
|
||||
from django.db.models import Q
|
||||
from django_core.mixins import BaseViewSetMixin
|
||||
from django.shortcuts import get_object_or_404
|
||||
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.permissions import AllowAny, IsAuthenticated
|
||||
from rest_framework.viewsets import ModelViewSet
|
||||
from rest_framework.generics import GenericAPIView
|
||||
from rest_framework.permissions import AllowAny, IsAuthenticated
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.viewsets import ModelViewSet
|
||||
|
||||
from core.apps.accounts.serializers.user import UserSerializer
|
||||
from core.apps.evaluation.filters.auto import AutoevaluationFilter
|
||||
from core.apps.evaluation.models import AutoEvaluationModel
|
||||
from core.apps.evaluation.serializers import AutoEvaluationSerializer
|
||||
from core.apps.evaluation.serializers.auto import (
|
||||
CreateAutoevaluationSerializer,
|
||||
ListAutoevaluationSerializer,
|
||||
@@ -155,7 +158,16 @@ class AutoEvaluationListAppraisersView(GenericAPIView):
|
||||
except Exception as e:
|
||||
return Response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
|
||||
@extend_schema(
|
||||
tags=["AutoEvaluation"],
|
||||
request=AutoEvaluationSerializer,
|
||||
)
|
||||
class AutoEvaluationRequestView(APIView):
|
||||
authentication_classes = []
|
||||
permission_classes = [AllowAny]
|
||||
|
||||
|
||||
def post(self, request):
|
||||
serializer = AutoEvaluationSerializer(data=request.data)
|
||||
|
||||
@@ -11,6 +11,7 @@ from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework import status
|
||||
|
||||
from core.apps.accounts.choices import RoleChoice
|
||||
from core.apps.evaluation.filters.request import EvaluationrequestFilter
|
||||
from core.apps.evaluation.models import EvaluationrequestModel
|
||||
from core.apps.evaluation.serializers.request import (
|
||||
|
||||
Reference in New Issue
Block a user