diff --git a/booth/urls.py b/booth/urls.py index a222cb8..9a04325 100644 --- a/booth/urls.py +++ b/booth/urls.py @@ -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 = [ diff --git a/booth/views.py b/booth/views.py index 620ba9c..3e10811 100644 --- a/booth/views.py +++ b/booth/views.py @@ -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 @@ -7,6 +7,7 @@ # Create your views here. from django_filters.rest_framework import DjangoFilterBackend import django_filters +from django.http import JsonResponse # Booth 필터 클래스 정의 @@ -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 @@ -61,4 +64,4 @@ class BoothDetailViewSet(generics.RetrieveUpdateAPIView): class BoothDetailListViewSet(generics.ListCreateAPIView): queryset = BoothDetail.objects.all() - serializer_class = BoothDetailSerializer \ No newline at end of file + serializer_class = BoothDetailSerializer