From 7c0c5f43fba3a09fa535ae70996998cafa020f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Schl=C3=B6gl?= Date: Wed, 25 Sep 2024 09:56:59 +0200 Subject: [PATCH] feat(generic): add an import button to the list views resolves #1171 --- apis_core/generic/abc.py | 5 +++++ apis_core/generic/templates/generic/generic_list.html | 2 ++ 2 files changed, 7 insertions(+) diff --git a/apis_core/generic/abc.py b/apis_core/generic/abc.py index 2f24f4a3c..72d500aa2 100644 --- a/apis_core/generic/abc.py +++ b/apis_core/generic/abc.py @@ -16,6 +16,11 @@ def get_createview_url(cls): ct = ContentType.objects.get_for_model(cls) return reverse("apis_core:generic:create", args=[ct]) + @classmethod + def get_importview_url(cls): + ct = ContentType.objects.get_for_model(cls) + return reverse("apis_core:generic:import", args=[ct]) + def get_edit_url(self): ct = ContentType.objects.get_for_model(self) return reverse("apis_core:generic:update", args=[ct, self.id]) diff --git a/apis_core/generic/templates/generic/generic_list.html b/apis_core/generic/templates/generic/generic_list.html index 28b9976f0..ce5c46f24 100644 --- a/apis_core/generic/templates/generic/generic_list.html +++ b/apis_core/generic/templates/generic/generic_list.html @@ -14,6 +14,8 @@ {% if object_list.model.get_add_permission in perms %} Create + Import {% endif %}