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

Merge branch 'feature/default_playlist_id' into 'master'

Allow updating of default_playlist_id

See merge request !16
parents c0aabb28 8882a972
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): ...@@ -471,9 +471,19 @@ class APIScheduleViewSet(viewsets.ModelViewSet):
if 'schedule' not in request.data: if 'schedule' not in request.data:
return Response(status=status.HTTP_400_BAD_REQUEST) 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 # First update submit -> return projected timeslots and collisions
if 'solutions' not in request.data: 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)) return Response(Schedule.make_conflicts(request.data['schedule'], pk, show_pk))
# Otherwise try to resolve # Otherwise try to resolve
......
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