| 210 | raise exceptions.NotFound() |
| 211 | |
| 212 | def patch(self, request, pk=None, project_pk=None, filename=None): |
| 213 | task = self.get_and_check_task(request, pk) |
| 214 | check_project_perms(request, task.project, perms=("change_project", )) |
| 215 | |
| 216 | if not task.media: |
| 217 | raise exceptions.NotFound() |
| 218 | |
| 219 | with transaction.atomic(): |
| 220 | task = self._lock_task(task) |
| 221 | |
| 222 | found = False |
| 223 | for entry in task.media: |
| 224 | if entry['filename'] == filename: |
| 225 | if 'description' in request.data: |
| 226 | entry['description'] = str(request.data['description'])[:4096] |
| 227 | found = True |
| 228 | break |
| 229 | |
| 230 | if not found: |
| 231 | raise exceptions.NotFound() |
| 232 | |
| 233 | task.save() |
| 234 | |
| 235 | return Response({'success': True}, status=status.HTTP_200_OK) |
| 236 | |
| 237 | def delete(self, request, pk=None, project_pk=None, filename=None): |
| 238 | task = self.get_and_check_task(request, pk) |