Skip to content

Commit

Permalink
chore: 인증 방식 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
dkfla committed Aug 5, 2024
1 parent cc06ec8 commit 05d5688
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
11 changes: 6 additions & 5 deletions friends/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
# from .serializers import FriendSerializer, FriendRequestSerializer
from accounts.models import User
from .models import Friend, FriendRequest
from django.views.decorators.csrf import csrf_exempt

# from django.views.decorators.csrf import csrf_exempt
from django.db.models import Count, Q
import random

Expand Down Expand Up @@ -47,9 +48,9 @@ def friend_restaurant_list(request, id):
)


@csrf_exempt
@api_view(["GET"])
# @login_required
# @authentication_classes([TokenAuthentication])
# @permission_classes([IsAuthenticated])
def friend_list(request):
try:
# user = request.user
Expand Down Expand Up @@ -97,9 +98,9 @@ def friend_list(request):
return Response({"message": "User not found"}, status=status.HTTP_404_NOT_FOUND)


@csrf_exempt
@api_view(["GET"])
# @login_required
# @authentication_classes([TokenAuthentication])
# @permission_classes([IsAuthenticated])
def friend_recommend(request):
try:
# user = request.user
Expand Down
10 changes: 6 additions & 4 deletions restaurants/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
RestaurantDetailSerializer,
)

# from rest_framework.authentication import TokenAuthentication
# from rest_framework.permissions import IsAuthenticated
# from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
import logging
Expand All @@ -26,9 +28,9 @@ def restaurant_list(request):
return Response(serializer.data)


@csrf_exempt
@api_view(["GET", "POST", "DELETE"])
# @login_required
# @authentication_classes([TokenAuthentication])
# @permission_classes([IsAuthenticated])
def search(request):
user = User.objects.get(id=21) # 임시 유저 지정, 추후 삭제
if request.method == "GET":
Expand Down Expand Up @@ -138,9 +140,9 @@ def add_remove_restaurant(request, pk):
)


@csrf_exempt
@api_view(["GET"])
# @login_required
# @authentication_classes([TokenAuthentication])
# @permission_classes([IsAuthenticated])
def restaurant_detail(request, pk):
try:
restaurant = Restaurant.objects.prefetch_related("reviews").get(pk=pk)
Expand Down

0 comments on commit 05d5688

Please sign in to comment.