File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -446,6 +446,7 @@ def register_custom_object_search_index(self, model):
446
446
def get_model (
447
447
self ,
448
448
skip_object_fields = False ,
449
+ no_cache = False ,
449
450
):
450
451
"""
451
452
Generates a temporary Django model based on available fields that belong to
@@ -458,7 +459,7 @@ def get_model(
458
459
"""
459
460
460
461
# 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 :
462
463
model = self .get_cached_model (self .id )
463
464
return model
464
465
@@ -550,7 +551,7 @@ def wrapped_post_through_setup(self, cls):
550
551
551
552
def get_model_with_serializer (self ):
552
553
from netbox_custom_objects .api .serializers import get_serializer_class
553
- model = self .get_model ()
554
+ model = self .get_model (no_cache = True )
554
555
get_serializer_class (model )
555
556
self .register_custom_object_search_index (model )
556
557
return model
Original file line number Diff line number Diff line change @@ -430,8 +430,8 @@ def get_queryset(self, request):
430
430
return model .objects .all ()
431
431
432
432
def get_object (self , ** kwargs ):
433
- # if self.object:
434
- # return self.object
433
+ if self .object :
434
+ return self .object
435
435
custom_object_type = self .kwargs .pop ("custom_object_type" , None )
436
436
object_type = get_object_or_404 (
437
437
CustomObjectType , slug = custom_object_type
You can’t perform that action at this time.
0 commit comments