Skip to content

Commit

Permalink
Merge pull request #45 from IAMBH/jbh
Browse files Browse the repository at this point in the history
🎨 양일 λΆ€μŠ€ ν•„ν„° μˆ˜μ •
  • Loading branch information
IAMBH authored Oct 10, 2023
2 parents 7bc2e11 + cd9fbad commit 5958531
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions booth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
from .paginations import BoothPagination

class BoothFilter(filters.FilterSet):
date = filters.NumberFilter(field_name='date')
# date = filters.NumberFilter(field_name='date')
start_date = filters.NumberFilter(field_name='start_date')
end_date = filters.NumberFilter(field_name='end_date')
type = filters.MultipleChoiceFilter(field_name='type', choices=Booth.TYPE_CHOICES)

class Meta:
model = Booth
fields = ['location', 'type', 'date']
fields = ['location', 'type', 'start_date', 'end_date']

class BoothViewSet(viewsets.GenericViewSet, mixins.ListModelMixin, mixins.RetrieveModelMixin):

Expand All @@ -32,7 +34,9 @@ class BoothViewSet(viewsets.GenericViewSet, mixins.ListModelMixin, mixins.Retrie
def get_queryset(self):
queryset = Booth.objects.annotate(
like_cnt = Count('likes'),
date = Extract('start_at', 'day')
# date = Extract('end_at', 'day')
start_date = Extract('start_at', 'day'),
end_date = Extract('end_at', 'day')
)
return queryset

Expand Down

0 comments on commit 5958531

Please sign in to comment.