Skip to content

Commit

Permalink
feat: boothdetail의 부스 이미지 booth 목록으로 불러오기, is_reservable 필드에 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ryann1203 committed Oct 3, 2024
1 parent b30720f commit 53d210c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 5.1.1 on 2024-10-02 22:37

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('booth', '0002_boothdetail'),
]

operations = [
migrations.AddField(
model_name='booth',
name='is_reservable',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='boothdetail',
name='is_reservable',
field=models.BooleanField(default=False),
),
]
14 changes: 13 additions & 1 deletion booth/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ class Meta:
model = User
fields = '__all__'

class BoothDetailImageSerializer(serializers.ModelSerializer):
class Meta:
model = BoothDetail
fields = ['image'] # BoothDetail의 image 필드만 포함


class BoothSerializer(serializers.ModelSerializer):
# BoothDetail의 image 필드만 포함
details_image = BoothDetailImageSerializer(source='details', read_only=True)

class Meta:
model = Booth
fields = '__all__'
fields = ['id', 'day', 'category', 'latitude', 'longitude',
'location', 'is_night', 'name', 'description', 'host',
'like_count', 'start_time', 'end_time', 'is_reservable', 'details_image']


class BoothDetailSerializer(serializers.ModelSerializer):
booth = serializers.PrimaryKeyRelatedField(queryset=Booth.objects.all())
Expand Down
1 change: 1 addition & 0 deletions booth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Meta:
'category': ['exact'], # 카테고리 필터
'location': ['exact'], # 위치 필터
'is_night': ['exact'], # True 또는 False 필터
'is_reservable': ['exact'], # 예약 가능여부 필터 (true, default)
}

class BoothViewSet(viewsets.ModelViewSet):
Expand Down

0 comments on commit 53d210c

Please sign in to comment.