Commit 287a4876 authored by Ben Waters's avatar Ben Waters

Fixed serializers with propoer foreign key nesting to reduce the number of rest calls

parent f9f8be98
......@@ -6,18 +6,18 @@ class CategorySerializer(serializers.ModelSerializer):
model = Category
class OpenTimeSerializer(serializers.ModelSerializer):
schedule = serializers.RelatedField(many=False)
class Meta:
model = OpenTime
class ScheduleSerializer(serializers.ModelSerializer):
open_times = OpenTimeSerializer(many=True)
class Meta:
model = Schedule
class FacilitySerializer(serializers.ModelSerializer):
main_schedule = ScheduleSerializer()
special_schedules = ScheduleSerializer(many=True)
category = serializers.RelatedField(many=False)
main_schedule = serializers.RelatedField(many=False)
special_schedules = serializers.RelatedField(many=True)
class Meta:
model = Facility
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment