Skip to content

Commit

Permalink
fix : url 수정, 이름순 정렬 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ryann1203 committed Sep 30, 2024
1 parent 36c65fb commit 2a8bfe0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion booth/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

app_name = 'booth'

router = SimpleRouter(trailing_slash=False)
router = SimpleRouter(trailing_slash=True)
router.register(r'booth', BoothViewSet, basename='booth')

urlpatterns = [
Expand Down
7 changes: 5 additions & 2 deletions booth/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.shortcuts import render
from django.shortcuts import render, get_object_or_404
from rest_framework import viewsets, mixins, generics
from rest_framework.response import Response
from rest_framework import status
Expand All @@ -7,6 +7,7 @@
# Create your views here.
from django_filters.rest_framework import DjangoFilterBackend
import django_filters
from django.http import JsonResponse


# Booth 필터 클래스 정의
Expand Down Expand Up @@ -51,6 +52,8 @@ def get_queryset(self):

if is_night is not None:
queryset = queryset.filter(is_night=is_night.lower() == 'true')

queryset = queryset.order_by('name')

return queryset

Expand All @@ -61,4 +64,4 @@ class BoothDetailViewSet(generics.RetrieveUpdateAPIView):

class BoothDetailListViewSet(generics.ListCreateAPIView):
queryset = BoothDetail.objects.all()
serializer_class = BoothDetailSerializer
serializer_class = BoothDetailSerializer

0 comments on commit 2a8bfe0

Please sign in to comment.