recently
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
# blog/urls.py
|
||||
|
||||
from django.urls import path
|
||||
from .views import PostListCreateView
|
||||
from .views import PostListView, PostListCreateView
|
||||
|
||||
urlpatterns = [
|
||||
path('posts/', PostListView.as_view(), name='post-list'),
|
||||
path('create/', PostListCreateView.as_view(), name='post-list-create'),
|
||||
]
|
||||
|
@ -1,5 +1,6 @@
|
||||
import requests
|
||||
from rest_framework.exceptions import AuthenticationFailed
|
||||
from django.conf import settings
|
||||
|
||||
def verify_token_with_auth_server(token: str):
|
||||
# url = "http://192.168.0.202:8000/api/auth/verify/"
|
||||
|
@ -5,6 +5,13 @@ from .models import Post
|
||||
from .serializers import PostSerializer
|
||||
from .utils import verify_token_with_auth_server # ✅ 추가
|
||||
|
||||
|
||||
class PostListView(generics.ListAPIView):
|
||||
queryset = Post.objects.all().order_by('-created_at')
|
||||
serializer_class = PostSerializer
|
||||
# permission_classes = [permissions.IsAuthenticated]
|
||||
permission_classes = [permissions.AllowAny]
|
||||
|
||||
class PostListCreateView(generics.ListCreateAPIView):
|
||||
queryset = Post.objects.all().order_by('-created_at')
|
||||
serializer_class = PostSerializer
|
||||
|
Reference in New Issue
Block a user