From 02a60bd41af0b2bb44e3db5ce36251e222e9a772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Schl=C3=B6gl?= Date: Tue, 17 Dec 2024 11:57:08 +0100 Subject: [PATCH] fix(generic): add `uri_set` to genericModel --- apis_core/generic/abc.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apis_core/generic/abc.py b/apis_core/generic/abc.py index 7610b7cca..72fe81621 100644 --- a/apis_core/generic/abc.py +++ b/apis_core/generic/abc.py @@ -218,3 +218,14 @@ def duplicate(self): return newobj duplicate.alters_data = True + + def uri_set(self): + ct = ContentType.objects.get_for_model(self) + return ( + ContentType.objects.get(app_label="apis_metainfo", model="uri") + .model_class() + .objects.filter(content_type=ct, object_id=self.id) + .all() + ) + +