evaluation-customer modeli yaratildi va kerakli fiealdlr qoshildi
This commit is contained in:
43
core/apps/evaluation/views/customer.py
Normal file
43
core/apps/evaluation/views/customer.py
Normal file
@@ -0,0 +1,43 @@
|
||||
from django_core.mixins import BaseViewSetMixin
|
||||
from drf_spectacular.utils import extend_schema
|
||||
from rest_framework.permissions import AllowAny
|
||||
from rest_framework.viewsets import ReadOnlyModelViewSet
|
||||
|
||||
from core.apps.evaluation.models import CustomerModel, PropertyOwnerModel
|
||||
from core.apps.evaluation.serializers.customer import (
|
||||
CreateCustomerSerializer,
|
||||
CreatePropertyOwnerSerializer,
|
||||
ListCustomerSerializer,
|
||||
ListPropertyOwnerSerializer,
|
||||
RetrieveCustomerSerializer,
|
||||
RetrievePropertyOwnerSerializer,
|
||||
)
|
||||
|
||||
|
||||
@extend_schema(tags=["Customer"])
|
||||
class CustomerView(BaseViewSetMixin, ReadOnlyModelViewSet):
|
||||
queryset = CustomerModel.objects.all()
|
||||
serializer_class = ListCustomerSerializer
|
||||
permission_classes = [AllowAny]
|
||||
|
||||
action_permission_classes = {}
|
||||
action_serializer_class = {
|
||||
"list": ListCustomerSerializer,
|
||||
"retrieve": RetrieveCustomerSerializer,
|
||||
"create": CreateCustomerSerializer,
|
||||
}
|
||||
|
||||
|
||||
@extend_schema(tags=["PropertyOwner"])
|
||||
class PropertyOwnerView(BaseViewSetMixin, ReadOnlyModelViewSet):
|
||||
queryset = PropertyOwnerModel.objects.all()
|
||||
serializer_class = ListPropertyOwnerSerializer
|
||||
permission_classes = [AllowAny]
|
||||
|
||||
action_permission_classes = {}
|
||||
action_serializer_class = {
|
||||
"list": ListPropertyOwnerSerializer,
|
||||
"retrieve": RetrievePropertyOwnerSerializer,
|
||||
"create": CreatePropertyOwnerSerializer,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user