kopia lustrzana https://github.com/OpenDroneMap/WebODM
Allow single file upload
rodzic
473b435acf
commit
0fc5387cf5
|
@ -181,8 +181,8 @@ class TaskViewSet(viewsets.ViewSet):
|
||||||
task.partial = False
|
task.partial = False
|
||||||
task.images_count = len(task.scan_images())
|
task.images_count = len(task.scan_images())
|
||||||
|
|
||||||
if task.images_count < 2:
|
if task.images_count < 1:
|
||||||
raise exceptions.ValidationError(detail=_("You need to upload at least 2 images before commit"))
|
raise exceptions.ValidationError(detail=_("You need to upload at least 1 file before commit"))
|
||||||
|
|
||||||
task.save()
|
task.save()
|
||||||
worker_tasks.process_task.delay(task.id)
|
worker_tasks.process_task.delay(task.id)
|
||||||
|
|
|
@ -114,13 +114,6 @@ class TestApiTask(BootTransactionTestCase):
|
||||||
}, format="multipart")
|
}, format="multipart")
|
||||||
self.assertTrue(res.status_code == status.HTTP_400_BAD_REQUEST)
|
self.assertTrue(res.status_code == status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
# Cannot create a task with just 1 image
|
|
||||||
res = client.post("/api/projects/{}/tasks/".format(project.id), {
|
|
||||||
'images': image1
|
|
||||||
}, format="multipart")
|
|
||||||
self.assertTrue(res.status_code == status.HTTP_400_BAD_REQUEST)
|
|
||||||
image1.seek(0)
|
|
||||||
|
|
||||||
# Normal case with images[], name and processing node parameter
|
# Normal case with images[], name and processing node parameter
|
||||||
res = client.post("/api/projects/{}/tasks/".format(project.id), {
|
res = client.post("/api/projects/{}/tasks/".format(project.id), {
|
||||||
'images': [image1, image2],
|
'images': [image1, image2],
|
||||||
|
@ -1118,10 +1111,6 @@ class TestApiTask(BootTransactionTestCase):
|
||||||
self.assertEqual(res.data['success'], True)
|
self.assertEqual(res.data['success'], True)
|
||||||
image1.seek(0)
|
image1.seek(0)
|
||||||
|
|
||||||
# Cannot commit with a single image
|
|
||||||
res = client.post("/api/projects/{}/tasks/{}/commit/".format(project.id, task.id))
|
|
||||||
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
|
|
||||||
|
|
||||||
# And second image
|
# And second image
|
||||||
res = client.post("/api/projects/{}/tasks/{}/upload/".format(project.id, task.id), {
|
res = client.post("/api/projects/{}/tasks/{}/upload/".format(project.id, task.id), {
|
||||||
'images': [image2],
|
'images': [image2],
|
||||||
|
|
|
@ -114,7 +114,7 @@ class ProcessingNode(models.Model):
|
||||||
|
|
||||||
:returns UUID of the newly created task
|
:returns UUID of the newly created task
|
||||||
"""
|
"""
|
||||||
if len(images) < 2: raise exceptions.NodeServerError("Need at least 2 images")
|
if len(images) < 1: raise exceptions.NodeServerError("Need at least 1 file")
|
||||||
|
|
||||||
api_client = self.api_client()
|
api_client = self.api_client()
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue