From 8750bebec57ff216173dc0b1bb02866981fb8afc Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 18 Sep 2025 17:16:12 -0700 Subject: [PATCH 1/3] use no_cache and get_model_with_serializer for api calls --- netbox_custom_objects/api/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox_custom_objects/api/views.py b/netbox_custom_objects/api/views.py index de95caf..f3a3231 100644 --- a/netbox_custom_objects/api/views.py +++ b/netbox_custom_objects/api/views.py @@ -50,7 +50,7 @@ def get_queryset(self): ) except CustomObjectType.DoesNotExist: raise Http404 - self.model = custom_object_type.get_model() + self.model = custom_object_type.get_model_with_serializer(no_cache=True) return self.model.objects.all() @property From 9a29f218559ce0deb07e82f231f046e58ae5e096 Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 19 Sep 2025 08:50:06 -0700 Subject: [PATCH 2/3] doc no_cache param --- netbox_custom_objects/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/netbox_custom_objects/models.py b/netbox_custom_objects/models.py index b497a26..09eafb3 100644 --- a/netbox_custom_objects/models.py +++ b/netbox_custom_objects/models.py @@ -454,6 +454,8 @@ def get_model( :param skip_object_fields: Don't add object or multiobject fields to the model :type skip_object_fields: bool + :param no_cache: Force regeneration of the model, bypassing cache + :type no_cache: bool :return: The generated model. :rtype: Model """ From 0cda38d38f1bd4aa593ed4033537e3d62ca1a56b Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 19 Sep 2025 09:01:36 -0700 Subject: [PATCH 3/3] fix no_cache --- netbox_custom_objects/api/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox_custom_objects/api/views.py b/netbox_custom_objects/api/views.py index f3a3231..039456f 100644 --- a/netbox_custom_objects/api/views.py +++ b/netbox_custom_objects/api/views.py @@ -50,7 +50,7 @@ def get_queryset(self): ) except CustomObjectType.DoesNotExist: raise Http404 - self.model = custom_object_type.get_model_with_serializer(no_cache=True) + self.model = custom_object_type.get_model_with_serializer() return self.model.objects.all() @property