Skip to content
Snippets Groups Projects
Verified Commit fadce108 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

Clean-up TimeslotSerializer

parent 8f997dd2
No related branches found
No related tags found
No related merge requests found
......@@ -678,29 +678,28 @@ class ScheduleDryRunResponseSerializer(serializers.Serializer):
class TimeSlotSerializer(serializers.ModelSerializer):
show = serializers.PrimaryKeyRelatedField(queryset=Show.objects.all())
schedule = serializers.PrimaryKeyRelatedField(queryset=Schedule.objects.all())
show = serializers.PrimaryKeyRelatedField(queryset=Show.objects.all(), required=False)
schedule = serializers.PrimaryKeyRelatedField(queryset=Schedule.objects.all(), required=False)
repetition_of = serializers.PrimaryKeyRelatedField(
queryset=TimeSlot.objects.all(), allow_null=True
allow_null=True,
queryset=TimeSlot.objects.all(),
required=False,
)
class Meta:
model = TimeSlot
fields = (
read_only_fields = (
"id",
"end",
"memo",
"note_id",
"playlist_id",
"repetition_of",
"schedule",
"show",
"start",
)
def create(self, validated_data):
"""Create and return a new TimeSlot instance, given the validated data."""
return TimeSlot.objects.create(**validated_data)
fields = (
"memo",
"playlist_id",
"repetition_of",
) + read_only_fields
def update(self, instance, validated_data):
"""Update and return an existing Show instance, given the validated data."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment