Skip to content
Snippets Groups Projects
Commit 8882a972 authored by Richard Blechinger's avatar Richard Blechinger
Browse files

Update default_playlist_id if set

parent c0aabb28
No related branches found
No related tags found
1 merge request!16Allow updating of default_playlist_id
......@@ -471,9 +471,19 @@ class APIScheduleViewSet(viewsets.ModelViewSet):
if 'schedule' not in request.data:
return Response(status=status.HTTP_400_BAD_REQUEST)
# If we're updating the default playlist id
# TODO: If nothing else than default_playlist_id, automation_id or is_repetition changed -> just save and don't do anything
new_schedule = request.data.get('schedule')
if 'default_playlist_id' in new_schedule:
schedule = get_object_or_404(Schedule, pk=pk, show=show_pk)
schedule.default_playlist_id = int(new_schedule['default_playlist_id'])
schedule.save()
serializer = ScheduleSerializer(schedule)
return Response(serializer.data)
# First update submit -> return projected timeslots and collisions
if 'solutions' not in request.data:
# TODO: If nothing else than default_playlist_id, automation_id or is_repetition changed -> just save and don't do anything
return Response(Schedule.make_conflicts(request.data['schedule'], pk, show_pk))
# Otherwise try to resolve
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment