Skip to content
Snippets Groups Projects
Commit 55375b9c authored by Mario Raciti's avatar Mario Raciti
Browse files

TMSS-519: Update scheduling_set/<id>/copy_draft(s)

parent 853073ef
No related branches found
No related tags found
1 merge request!458Resolve TMSS-519
...@@ -658,8 +658,8 @@ class SchedulingUnitDraftCopyFromSchedulingSetViewSet(LOFARCopyViewSet): ...@@ -658,8 +658,8 @@ class SchedulingUnitDraftCopyFromSchedulingSetViewSet(LOFARCopyViewSet):
403: 'forbidden'}, 403: 'forbidden'},
operation_description="Create a copy of all the TaskDrafts in this Scheduling Unit Set.") operation_description="Create a copy of all the TaskDrafts in this Scheduling Unit Set.")
def create(self, request, *args, **kwargs): def create(self, request, *args, **kwargs):
if 'scheduling_set_id' in kwargs: if 'id' in kwargs:
scheduling_set = get_object_or_404(models.SchedulingSet, pk=kwargs['scheduling_set_id']) scheduling_set = get_object_or_404(models.SchedulingSet, pk=kwargs['id'])
scheduling_unit_drafts = scheduling_set.scheduling_unit_drafts.all() scheduling_unit_drafts = scheduling_set.scheduling_unit_drafts.all()
body_unicode = request.body.decode('utf-8') body_unicode = request.body.decode('utf-8')
...@@ -686,7 +686,7 @@ class SchedulingUnitDraftCopyFromSchedulingSetViewSet(LOFARCopyViewSet): ...@@ -686,7 +686,7 @@ class SchedulingUnitDraftCopyFromSchedulingSetViewSet(LOFARCopyViewSet):
# just return as a response the serialized scheduling_set (with references to the created copy_scheduling_unit_draft(s) # just return as a response the serialized scheduling_set (with references to the created copy_scheduling_unit_draft(s)
return Response(serializers.SchedulingSetSerializer(scheduling_set, context={'request':request}).data,status=status.HTTP_201_CREATED) return Response(serializers.SchedulingSetSerializer(scheduling_set, context={'request':request}).data,status=status.HTTP_201_CREATED)
else: else:
content = {'Error': 'scheduling_set_id is missing'} content = {'Error': 'SchedulingSet id is missing'}
return Response(content, status=status.HTTP_404_NOT_FOUND) return Response(content, status=status.HTTP_404_NOT_FOUND)
class SchedulingUnitBlueprintCopyToSchedulingUnitDraftViewSet(LOFARCopyViewSet): class SchedulingUnitBlueprintCopyToSchedulingUnitDraftViewSet(LOFARCopyViewSet):
......
...@@ -185,7 +185,7 @@ router.register(r'task_blueprint/(?P<task_blueprint_id>\d+)/subtask', viewsets.S ...@@ -185,7 +185,7 @@ router.register(r'task_blueprint/(?P<task_blueprint_id>\d+)/subtask', viewsets.S
# copy # copy
router.register(r'task_draft/(?P<task_draft_id>\d+)/copy', viewsets.TaskDraftCopyViewSet) router.register(r'task_draft/(?P<task_draft_id>\d+)/copy', viewsets.TaskDraftCopyViewSet)
router.register(r'task_blueprint/(?P<id>\d+)/copy_to_draft', viewsets.TaskBlueprintCopyToTaskDraftViewSet) router.register(r'task_blueprint/(?P<id>\d+)/copy_to_draft', viewsets.TaskBlueprintCopyToTaskDraftViewSet)
router.register(r'scheduling_set/(?P<scheduling_set_id>\d+)/copy_scheduling_unit_drafts', viewsets.SchedulingUnitDraftCopyFromSchedulingSetViewSet) router.register(r'scheduling_set/(?P<id>\d+)/copy_draft\(s\)', viewsets.SchedulingUnitDraftCopyFromSchedulingSetViewSet)
router.register(r'scheduling_unit_draft/(?P<id>\d+)/copy', viewsets.SchedulingUnitDraftCopyViewSet) router.register(r'scheduling_unit_draft/(?P<id>\d+)/copy', viewsets.SchedulingUnitDraftCopyViewSet)
router.register(r'scheduling_unit_blueprint/(?P<id>\d+)/copy_draft', viewsets.SchedulingUnitBlueprintCopyToSchedulingUnitDraftViewSet) router.register(r'scheduling_unit_blueprint/(?P<id>\d+)/copy_draft', viewsets.SchedulingUnitBlueprintCopyToSchedulingUnitDraftViewSet)
......
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