Skip to content

Commit 338a3d6

Browse files
committed
test
1 parent 2f0a606 commit 338a3d6

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

netbox_custom_objects/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ def register_custom_object_search_index(self, model):
446446
def get_model(
447447
self,
448448
skip_object_fields=False,
449+
no_cache=False,
449450
):
450451
"""
451452
Generates a temporary Django model based on available fields that belong to
@@ -458,7 +459,7 @@ def get_model(
458459
"""
459460

460461
# Double-check pattern: check cache again after acquiring lock
461-
if self.is_model_cached(self.id):
462+
if self.is_model_cached(self.id) and not no_cache:
462463
model = self.get_cached_model(self.id)
463464
return model
464465

@@ -550,7 +551,7 @@ def wrapped_post_through_setup(self, cls):
550551

551552
def get_model_with_serializer(self):
552553
from netbox_custom_objects.api.serializers import get_serializer_class
553-
model = self.get_model()
554+
model = self.get_model(no_cache=True)
554555
get_serializer_class(model)
555556
self.register_custom_object_search_index(model)
556557
return model

netbox_custom_objects/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,8 @@ def get_queryset(self, request):
430430
return model.objects.all()
431431

432432
def get_object(self, **kwargs):
433-
# if self.object:
434-
# return self.object
433+
if self.object:
434+
return self.object
435435
custom_object_type = self.kwargs.pop("custom_object_type", None)
436436
object_type = get_object_or_404(
437437
CustomObjectType, slug=custom_object_type

0 commit comments

Comments
 (0)