fix: /banks permission fixed
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
from django.urls import path, include
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from rest_framework.routers import DefaultRouter # type: ignore
|
||||
|
||||
from . import views
|
||||
|
||||
router = DefaultRouter()
|
||||
router.register(r"banks", views.BankView, "banks")
|
||||
|
||||
router.register(r"banks", views.BankView, "banks") # type: ignore
|
||||
|
||||
urlpatterns = [
|
||||
path("", include(router.urls)),
|
||||
path("", include(router.urls)), # type: ignore
|
||||
]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from django_core.mixins import BaseViewSetMixin
|
||||
from django_core.mixins import BaseViewSetMixin # type: ignore
|
||||
from drf_spectacular.utils import extend_schema
|
||||
from rest_framework.permissions import IsAdminUser
|
||||
from rest_framework.viewsets import ModelViewSet
|
||||
from rest_framework.permissions import AllowAny, IsAdminUser # type: ignore
|
||||
from rest_framework.viewsets import ModelViewSet # type: ignore
|
||||
|
||||
from core.apps.banks.models import BankModel
|
||||
from core.apps.banks.serializers.banks import (
|
||||
@@ -13,14 +13,20 @@ from core.apps.banks.serializers.banks import (
|
||||
)
|
||||
|
||||
|
||||
###################################################################################
|
||||
# @view-set | POST, GET - /banks
|
||||
###################################################################################
|
||||
@extend_schema(tags=["Banks"])
|
||||
class BankView(BaseViewSetMixin, ModelViewSet):
|
||||
queryset = BankModel.objects.all()
|
||||
serializer_class = ListBankSerializer
|
||||
permission_classes = [IsAdminUser]
|
||||
|
||||
action_permission_classes = {}
|
||||
action_serializer_class = {
|
||||
action_permission_classes = {
|
||||
"list": [AllowAny],
|
||||
"retrieve": [AllowAny],
|
||||
}
|
||||
action_serializer_class = { # type: ignore
|
||||
"list": ListBankSerializer,
|
||||
"retrieve": RetrieveBankSerializer,
|
||||
"create": CreateBankSerializer,
|
||||
|
||||
Reference in New Issue
Block a user