Commit 0235d34b authored by Benjamin S Waters's avatar Benjamin S Waters

Merge branch 'feature/relations' into 'master'

Feature/relations

Proper foreign key nesting with related fields. meant to reduce  REST calls

See merge request !2
parents 1f7ef634 64cf50bf
......@@ -6,18 +6,19 @@ 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