From 07263a4de8146b13fe9c6e7d619144b354db1402 Mon Sep 17 00:00:00 2001 From: Parsa Nazer Date: Thu, 30 Jan 2025 00:06:44 +0330 Subject: [PATCH] add auth class --- backend/blog/views.py | 3 ++- backend/home/views.py | 1 + backend/product/views.py | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/blog/views.py b/backend/blog/views.py index 5bd3628..48dcfa7 100644 --- a/backend/blog/views.py +++ b/backend/blog/views.py @@ -12,6 +12,7 @@ from drf_spectacular.utils import extend_schema, OpenApiParameter, OpenApiTypes class AllBlogView(APIView): serializer_class = AllBlogSerilizer pagination_class = StructurePagination + authentication_classes = [] @extend_schema( parameters=[ OpenApiParameter( @@ -43,7 +44,7 @@ class AllBlogView(APIView): class BlogView(APIView): serializer_class = BlogSerilizer - + authentication_classes = [] def get_client_ip(self, request): """Helper function to get the client IP from request headers.""" x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR') diff --git a/backend/home/views.py b/backend/home/views.py index 815a2e4..8d78300 100644 --- a/backend/home/views.py +++ b/backend/home/views.py @@ -8,6 +8,7 @@ from rest_framework import status class HomeView(APIView): + authentication_classes = [] def get(self, request): dollor_object, _ = DollorModel.objects.get_or_create(unique_filed='unique') diff --git a/backend/product/views.py b/backend/product/views.py index 7f6754a..e0e8f2b 100644 --- a/backend/product/views.py +++ b/backend/product/views.py @@ -24,6 +24,7 @@ from rest_framework.permissions import AllowAny class AllCategories(APIView): serializer_class = MainCategorySerializer + authentication_classes = [] @extend_schema( # parameters=[ # OpenApiParameter( @@ -50,6 +51,7 @@ class AllCategories(APIView): class ProductView(APIView): serializer_class = ProductSerializer permission_classes = [AllowAny] + authentication_classes = [] def get(self, request, pk): product = get_object_or_404(ProductModel, id=pk) dollor_object, _ = DollorModel.objects.get_or_create(unique_filed='unique') @@ -61,7 +63,7 @@ class ProductView(APIView): class AllProductsView(APIView): serializer_class = ProductSerializer pagination_class = StructurePagination - + authentication_classes = [] @extend_schema( parameters=[ OpenApiParameter(