From d297ccbd9a3da754294cbc174db4242184378aab Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 23 Feb 2026 17:51:31 +0100 Subject: ✨ admin - import item keys: add filter, column and warning message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/admin.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py index 81ca7c28c..fe907d3a6 100644 --- a/ishtar_common/admin.py +++ b/ishtar_common/admin.py @@ -2517,11 +2517,11 @@ admin_site.register(models.SpatialReferenceSystem, SpatialReferenceSystemAdmin) @admin.register(models.ItemKey, site=admin_site) class ItemKeyAdmin(ImportJSONActionAdmin): list_display = ( - "content_type", "content_type_model", "key", "content_object", "linked_to_all", - "linked_to_importer_type", "linked_to_importer", "linked_to_user" + "content_type", "content_type_model", "key", "importer_type", "content_object", + "linked_to_all", "linked_to_importer_type", "linked_to_importer", "linked_to_user" ) search_fields = ("key", "content_type__model") - list_filter = (("content_type", admin.RelatedOnlyFieldListFilter),) + list_filter = (("content_type", admin.RelatedOnlyFieldListFilter), "importer_type") autocomplete_fields = ["user", "ishtar_import"] actions = [ serialize_type_action @@ -2532,6 +2532,16 @@ class ItemKeyAdmin(ImportJSONActionAdmin): "ishtar_import__isnull": True } + def changelist_view(self, *args, **kwargs): + returned = super().changelist_view(*args, **kwargs) + request = args[0] + self.message_user( + request, + _("Export to JSON action: Only keys linked to no user and no import " + "are exported."), + level=messages.WARNING) + return returned + @admin.register(models.TargetKey, site=admin_site) class TargetKeyAdmin(admin.ModelAdmin): -- cgit v1.2.3