diff --git a/src/etools/applications/partners/locale/ar/LC_MESSAGES/django.po b/src/etools/applications/partners/locale/ar/LC_MESSAGES/django.po index 45d24a4d55..09cea1a9b0 100644 --- a/src/etools/applications/partners/locale/ar/LC_MESSAGES/django.po +++ b/src/etools/applications/partners/locale/ar/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-26 12:56+0000\n" +"POT-Creation-Date: 2024-05-21 04:41+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2110,6 +2110,9 @@ msgstr "تم إرسال PD بالفعل إلى الشريك." msgid "Meeting date is not available." msgstr "تاريخ الاجتماع غير متاح." +msgid "No valid data found in the file." +msgstr "" + msgid "Action is not allowed" msgstr "الإجراء غير مسموح به" diff --git a/src/etools/applications/partners/locale/es/LC_MESSAGES/django.po b/src/etools/applications/partners/locale/es/LC_MESSAGES/django.po index 4fdc23fd88..5001826676 100644 --- a/src/etools/applications/partners/locale/es/LC_MESSAGES/django.po +++ b/src/etools/applications/partners/locale/es/LC_MESSAGES/django.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: et-partners2-bk\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-26 12:56+0000\n" +"POT-Creation-Date: 2024-05-21 04:41+0000\n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -2160,6 +2160,9 @@ msgstr "El PD ya se ha enviado al socio." msgid "Meeting date is not available." msgstr "La fecha de la reunión no está disponible." +msgid "No valid data found in the file." +msgstr "" + msgid "Action is not allowed" msgstr "No se permite la acción" diff --git a/src/etools/applications/partners/locale/fr/LC_MESSAGES/django.po b/src/etools/applications/partners/locale/fr/LC_MESSAGES/django.po index 98caab162d..e993259a2f 100644 --- a/src/etools/applications/partners/locale/fr/LC_MESSAGES/django.po +++ b/src/etools/applications/partners/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-26 12:56+0000\n" +"POT-Creation-Date: 2024-05-21 04:41+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2175,6 +2175,9 @@ msgstr "PD a déjà été envoyé au partenaire." msgid "Meeting date is not available." msgstr "La date de la réunion n'est pas disponible." +msgid "No valid data found in the file." +msgstr "" + msgid "Action is not allowed" msgstr "L'action n'est pas autorisée" diff --git a/src/etools/applications/partners/locale/pt/LC_MESSAGES/django.po b/src/etools/applications/partners/locale/pt/LC_MESSAGES/django.po index 3aa2bb39f0..57e8b4c536 100644 --- a/src/etools/applications/partners/locale/pt/LC_MESSAGES/django.po +++ b/src/etools/applications/partners/locale/pt/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-26 12:56+0000\n" +"POT-Creation-Date: 2024-05-21 04:41+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2186,6 +2186,9 @@ msgstr "O PD já foi enviado ao parceiro." msgid "Meeting date is not available." msgstr "A data da reunião não está disponível." +msgid "No valid data found in the file." +msgstr "" + msgid "Action is not allowed" msgstr "A ação não é permitida" diff --git a/src/etools/applications/partners/locale/ru/LC_MESSAGES/django.po b/src/etools/applications/partners/locale/ru/LC_MESSAGES/django.po index 16c7e0d97c..9728509bdc 100644 --- a/src/etools/applications/partners/locale/ru/LC_MESSAGES/django.po +++ b/src/etools/applications/partners/locale/ru/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-26 12:56+0000\n" +"POT-Creation-Date: 2024-05-21 04:41+0000\n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -2155,6 +2155,9 @@ msgstr "PD уже отправлен партнеру." msgid "Meeting date is not available." msgstr "Дата встречи неизвестна." +msgid "No valid data found in the file." +msgstr "" + msgid "Action is not allowed" msgstr "Действие не разрешено" diff --git a/src/etools/applications/partners/tests/test_v3_interventions.py b/src/etools/applications/partners/tests/test_v3_interventions.py index 453c90df6a..b1da5358b9 100644 --- a/src/etools/applications/partners/tests/test_v3_interventions.py +++ b/src/etools/applications/partners/tests/test_v3_interventions.py @@ -1671,6 +1671,30 @@ def test_upload_invalid_file(self): self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertIn("supply_items_file", response.data) + def test_upload_no_valid_data(self): + response = self.forced_auth_req( + "post", + reverse( + "pmp_v3:intervention-supply-item-upload", + args=[self.intervention.pk], + ), + data={ + "supply_items_file": SimpleUploadedFile( + 'my_list.csv', + u'''"unknown column","column2"\n + 42,"qwert"\n + 43,"asdf"\n + '''.encode('utf-8'), + content_type="multipart/form-data", + ), + }, + user=self.unicef_user, + request_format=None, + ) + self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) + self.assertIn("supply_items_file", response.data) + self.assertEqual(response.data["supply_items_file"], "No valid data found in the file.") + def test_upload_invalid_file_row(self): supply_items_file = SimpleUploadedFile( 'my_list.csv', diff --git a/src/etools/applications/partners/views/interventions_v3.py b/src/etools/applications/partners/views/interventions_v3.py index d0ba66fdfe..c4643f7920 100644 --- a/src/etools/applications/partners/views/interventions_v3.py +++ b/src/etools/applications/partners/views/interventions_v3.py @@ -519,6 +519,11 @@ def post(self, request, *args, **kwargs): {"supply_items_file": err.detail}, status.HTTP_400_BAD_REQUEST, ) + if not file_data: + return Response( + {"supply_items_file": _("No valid data found in the file.")}, + status.HTTP_400_BAD_REQUEST, + ) # update all supply items related to intervention for title, unit_number, unit_price, product_number in file_data: