db va type togirlandi
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
from .category import * # noqa
|
||||
from .products import * # noqa
|
||||
from .type import * # noqa
|
||||
|
||||
20
core/apps/api/views/type.py
Normal file
20
core/apps/api/views/type.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from core.apps.api.models import TypeModel
|
||||
from core.apps.api.serializers.type import RetrieveTypeSerializer, ListTypeSerializer, CreateTypeSerializer
|
||||
from rest_framework.viewsets import ReadOnlyModelViewSet
|
||||
from rest_framework.permissions import AllowAny
|
||||
from drf_spectacular.utils import extend_schema
|
||||
from django_core.mixins import BaseViewSetMixin
|
||||
|
||||
|
||||
@extend_schema(tags=["type"])
|
||||
class TypeView(BaseViewSetMixin, ReadOnlyModelViewSet):
|
||||
queryset = TypeModel.objects.all()
|
||||
serializer_class = ListTypeSerializer
|
||||
permission_classes = [AllowAny]
|
||||
|
||||
action_permission_classes = {}
|
||||
action_serializer_class = {
|
||||
"list": ListTypeSerializer,
|
||||
"retrieve": RetrieveTypeSerializer,
|
||||
"create": CreateTypeSerializer,
|
||||
}
|
||||
Reference in New Issue
Block a user