From fbe76ac98aa2d58421dcb64cfe1a2898b4c50ad6 Mon Sep 17 00:00:00 2001 From: Marko Hauptvogel Date: Thu, 30 Oct 2025 14:08:15 +0100 Subject: [PATCH] Fix non-existent-id error message Change this one special case to also use the same communication channel (toast notification) and message format as all other validation errors. The error message is kept mostly the same, just the index prefix is removed. This allowed keeping and easily adjusting the existing localizations of it. --- netbox/netbox/views/generic/bulk_views.py | 10 +++++++--- netbox/translations/cs/LC_MESSAGES/django.po | 4 ++-- netbox/translations/da/LC_MESSAGES/django.po | 4 ++-- netbox/translations/de/LC_MESSAGES/django.po | 4 ++-- netbox/translations/en/LC_MESSAGES/django.po | 2 +- netbox/translations/es/LC_MESSAGES/django.po | 4 ++-- netbox/translations/fr/LC_MESSAGES/django.po | 4 ++-- netbox/translations/it/LC_MESSAGES/django.po | 4 ++-- netbox/translations/ja/LC_MESSAGES/django.po | 4 ++-- netbox/translations/nl/LC_MESSAGES/django.po | 4 ++-- netbox/translations/pl/LC_MESSAGES/django.po | 4 ++-- netbox/translations/pt/LC_MESSAGES/django.po | 4 ++-- netbox/translations/ru/LC_MESSAGES/django.po | 4 ++-- netbox/translations/tr/LC_MESSAGES/django.po | 4 ++-- netbox/translations/uk/LC_MESSAGES/django.po | 4 ++-- netbox/translations/zh/LC_MESSAGES/django.po | 4 ++-- 16 files changed, 36 insertions(+), 32 deletions(-) diff --git a/netbox/netbox/views/generic/bulk_views.py b/netbox/netbox/views/generic/bulk_views.py index 8d94273b1..7b7876532 100644 --- a/netbox/netbox/views/generic/bulk_views.py +++ b/netbox/netbox/views/generic/bulk_views.py @@ -323,7 +323,7 @@ class BulkCreateView(GetReturnURLMixin, BaseMultiObjectView): class BulkImportView(GetReturnURLMixin, BaseMultiObjectView): """ - Import objects in bulk (CSV format). + Import objects in bulk (CSV/JSON/YAML format). Attributes: model_form: The form used to create each imported object @@ -456,8 +456,12 @@ class BulkImportView(GetReturnURLMixin, BaseMultiObjectView): try: instance = prefetched_objects[object_id] except KeyError: - form.add_error('data', _("Row {i}: Object with ID {id} does not exist").format(i=i, id=object_id)) - raise ValidationError('') + raise ValidationError( + self._compile_form_errors( + {'id': [_("Object with ID {id} does not exist").format(id=object_id)]}, + index=i + ) + ) # Take a snapshot for change logging if instance.pk and hasattr(instance, 'snapshot'): diff --git a/netbox/translations/cs/LC_MESSAGES/django.po b/netbox/translations/cs/LC_MESSAGES/django.po index 18a542b78..b755550e8 100644 --- a/netbox/translations/cs/LC_MESSAGES/django.po +++ b/netbox/translations/cs/LC_MESSAGES/django.po @@ -12822,8 +12822,8 @@ msgstr "" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "Řádek {i}: Objekt s ID {id} neexistuje" +msgid "Object with ID {id} does not exist" +msgstr "Objekt s ID {id} neexistuje" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format diff --git a/netbox/translations/da/LC_MESSAGES/django.po b/netbox/translations/da/LC_MESSAGES/django.po index 4bbe9c02c..52b507cd0 100644 --- a/netbox/translations/da/LC_MESSAGES/django.po +++ b/netbox/translations/da/LC_MESSAGES/django.po @@ -12857,8 +12857,8 @@ msgstr "" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "Række {i}: Objekt med ID {id} findes ikke" +msgid "Object with ID {id} does not exist" +msgstr "Objekt med ID {id} findes ikke" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format diff --git a/netbox/translations/de/LC_MESSAGES/django.po b/netbox/translations/de/LC_MESSAGES/django.po index 6f7a9c873..1f6f4b642 100644 --- a/netbox/translations/de/LC_MESSAGES/django.po +++ b/netbox/translations/de/LC_MESSAGES/django.po @@ -13055,8 +13055,8 @@ msgstr "" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "Reihe {i}: Objekt mit ID {id} existiert nicht" +msgid "Object with ID {id} does not exist" +msgstr "Objekt mit ID {id} existiert nicht" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format diff --git a/netbox/translations/en/LC_MESSAGES/django.po b/netbox/translations/en/LC_MESSAGES/django.po index 7104111c4..d45c9b533 100644 --- a/netbox/translations/en/LC_MESSAGES/django.po +++ b/netbox/translations/en/LC_MESSAGES/django.po @@ -12513,7 +12513,7 @@ msgstr "" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" +msgid "Object with ID {id} does not exist" msgstr "" #: netbox/netbox/views/generic/bulk_views.py:525 diff --git a/netbox/translations/es/LC_MESSAGES/django.po b/netbox/translations/es/LC_MESSAGES/django.po index fd19f2b2a..9af4648ec 100644 --- a/netbox/translations/es/LC_MESSAGES/django.po +++ b/netbox/translations/es/LC_MESSAGES/django.po @@ -12999,8 +12999,8 @@ msgstr "" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "Fila {i}: Objeto con ID {id} no existe" +msgid "Object with ID {id} does not exist" +msgstr "Objeto con ID {id} no existe" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format diff --git a/netbox/translations/fr/LC_MESSAGES/django.po b/netbox/translations/fr/LC_MESSAGES/django.po index 1487fa2b5..53166a755 100644 --- a/netbox/translations/fr/LC_MESSAGES/django.po +++ b/netbox/translations/fr/LC_MESSAGES/django.po @@ -13041,8 +13041,8 @@ msgstr "" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "Rangée {i}: Objet avec identifiant {id} n'existe pas" +msgid "Object with ID {id} does not exist" +msgstr "Objet avec identifiant {id} n'existe pas" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format diff --git a/netbox/translations/it/LC_MESSAGES/django.po b/netbox/translations/it/LC_MESSAGES/django.po index e1132e620..9cd49edc0 100644 --- a/netbox/translations/it/LC_MESSAGES/django.po +++ b/netbox/translations/it/LC_MESSAGES/django.po @@ -13033,8 +13033,8 @@ msgstr "" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "Fila {i}: Oggetto con ID {id} non esiste" +msgid "Object with ID {id} does not exist" +msgstr "Oggetto con ID {id} non esiste" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format diff --git a/netbox/translations/ja/LC_MESSAGES/django.po b/netbox/translations/ja/LC_MESSAGES/django.po index 4ffdf7838..76db9e261 100644 --- a/netbox/translations/ja/LC_MESSAGES/django.po +++ b/netbox/translations/ja/LC_MESSAGES/django.po @@ -12645,8 +12645,8 @@ msgstr "選択したエクスポートテンプレートをレンダリング中 #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "行 {i}: ID {id}のオブジェクトは存在しません" +msgid "Object with ID {id} does not exist" +msgstr "ID {id}のオブジェクトは存在しません" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format diff --git a/netbox/translations/nl/LC_MESSAGES/django.po b/netbox/translations/nl/LC_MESSAGES/django.po index 0f7b297a4..2f820f94c 100644 --- a/netbox/translations/nl/LC_MESSAGES/django.po +++ b/netbox/translations/nl/LC_MESSAGES/django.po @@ -13000,8 +13000,8 @@ msgstr "" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "Rij {i}: Object met ID {id} bestaat niet" +msgid "Object with ID {id} does not exist" +msgstr "Object met ID {id} bestaat niet" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format diff --git a/netbox/translations/pl/LC_MESSAGES/django.po b/netbox/translations/pl/LC_MESSAGES/django.po index 6f7ccee02..be5b12c07 100644 --- a/netbox/translations/pl/LC_MESSAGES/django.po +++ b/netbox/translations/pl/LC_MESSAGES/django.po @@ -12920,8 +12920,8 @@ msgstr "" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "Wiersz {i}: Obiekt z identyfikatorem {id} nie istnieje" +msgid "Object with ID {id} does not exist" +msgstr "Obiekt z identyfikatorem {id} nie istnieje" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format diff --git a/netbox/translations/pt/LC_MESSAGES/django.po b/netbox/translations/pt/LC_MESSAGES/django.po index 0e9f8e32c..a96ea2695 100644 --- a/netbox/translations/pt/LC_MESSAGES/django.po +++ b/netbox/translations/pt/LC_MESSAGES/django.po @@ -12944,8 +12944,8 @@ msgstr "" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "Linha {i}: Objeto com ID {id} não existe" +msgid "Object with ID {id} does not exist" +msgstr "Objeto com ID {id} não existe" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format diff --git a/netbox/translations/ru/LC_MESSAGES/django.po b/netbox/translations/ru/LC_MESSAGES/django.po index 00946d050..c1d6722f2 100644 --- a/netbox/translations/ru/LC_MESSAGES/django.po +++ b/netbox/translations/ru/LC_MESSAGES/django.po @@ -12939,8 +12939,8 @@ msgstr "" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "Ряд {i}: Объект с идентификатором {id} не существует" +msgid "Object with ID {id} does not exist" +msgstr "Объект с идентификатором {id} не существует" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format diff --git a/netbox/translations/tr/LC_MESSAGES/django.po b/netbox/translations/tr/LC_MESSAGES/django.po index 24e98b629..254c994b3 100644 --- a/netbox/translations/tr/LC_MESSAGES/django.po +++ b/netbox/translations/tr/LC_MESSAGES/django.po @@ -12835,8 +12835,8 @@ msgstr "" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "Satır {i}: Kimliği olan nesne {id} mevcut değil" +msgid "Object with ID {id} does not exist" +msgstr "Kimliği olan nesne {id} mevcut değil" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format diff --git a/netbox/translations/uk/LC_MESSAGES/django.po b/netbox/translations/uk/LC_MESSAGES/django.po index edd3d9d83..a3d8ecda8 100644 --- a/netbox/translations/uk/LC_MESSAGES/django.po +++ b/netbox/translations/uk/LC_MESSAGES/django.po @@ -12920,8 +12920,8 @@ msgstr "" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "Ряд {i}: Об'єкт з ідентифікатором {id} не існує" +msgid "Object with ID {id} does not exist" +msgstr "Об'єкт з ідентифікатором {id} не існує" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format diff --git a/netbox/translations/zh/LC_MESSAGES/django.po b/netbox/translations/zh/LC_MESSAGES/django.po index ce8622504..524612e27 100644 --- a/netbox/translations/zh/LC_MESSAGES/django.po +++ b/netbox/translations/zh/LC_MESSAGES/django.po @@ -12622,8 +12622,8 @@ msgstr "渲染所选导出模板时出错 ({template}): {error}" #: netbox/netbox/views/generic/bulk_views.py:442 #, python-brace-format -msgid "Row {i}: Object with ID {id} does not exist" -msgstr "第{i}行: ID为{id}的对象不存在" +msgid "Object with ID {id} does not exist" +msgstr "ID为{id}的对象不存在" #: netbox/netbox/views/generic/bulk_views.py:525 #, python-brace-format