Skip to content

Commit

Permalink
Merge pull request #42 from forestsoob/booth
Browse files Browse the repository at this point in the history
[Feature] 백엔드 축제 사이트 라인나우 예약 필터링 구현
  • Loading branch information
forestsoob authored Oct 2, 2024
2 parents ebdc6d3 + 68d02a5 commit b30720f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions booth/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Booth(models.Model):
like_count = models.IntegerField(default=0)
start_time = models.TimeField()
end_time = models.TimeField()
is_reservable = models.BooleanField(default=False)

def __str__(self):
return self.name
Expand All @@ -32,6 +33,7 @@ class BoothDetail(models.Model):
insta_link = models.TextField(blank=True) # 인스타그램 링크
image = models.ImageField(upload_to="booth/", blank=True, null=True) # 부스 이미지
like_count = models.IntegerField(default=0) # 부스 좋아요
is_reservable = models.BooleanField(default=False)

def save(self, *args, **kwargs):
self.like_count = self.booth.like_count
Expand Down
6 changes: 6 additions & 0 deletions booth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def get_queryset(self):
category = self.request.query_params.get('category')
location = self.request.query_params.get('location')
is_night = self.request.query_params.get('is_night')
is_reservable = self.request.query_params.get('is_reservable') # 예약 가능 필터

# day가 None이면 'Mon'으로 기본 설정
if day is None:
Expand All @@ -53,6 +54,11 @@ def get_queryset(self):
if is_night is not None:
queryset = queryset.filter(is_night=is_night.lower() == 'true')

# 예약 가능 여부 필터링 추가
if is_reservable is not None:
queryset = queryset.filter(is_reservable=is_reservable.lower() == 'true')


queryset = queryset.order_by('name')

return queryset
Expand Down

0 comments on commit b30720f

Please sign in to comment.