Skip to content

Commit ee8a0c2

Browse files
committed
change no_cache to default True
1 parent d8a7fd2 commit ee8a0c2

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

netbox_custom_objects/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def get_model(self, model_name, require_ready=True):
9090
"App '%s' doesn't have a '%s' model." % (self.label, model_name)
9191
)
9292

93-
return obj.get_model()
93+
return obj.get_model(no_cache=False)
9494

9595
def get_models(self, include_auto_created=False, include_swapped=False):
9696
"""Return all models for this plugin, including custom object type models."""
@@ -116,7 +116,7 @@ def get_models(self, include_auto_created=False, include_swapped=False):
116116

117117
custom_object_types = CustomObjectType.objects.all()
118118
for custom_type in custom_object_types:
119-
model = custom_type.get_model()
119+
model = custom_type.get_model(no_cache=False)
120120
if model:
121121
yield model
122122

netbox_custom_objects/field_types.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,11 +988,12 @@ def create_m2m_table(self, instance, model, field_name):
988988
apps = model._meta.apps
989989

990990
app_models = apps.all_models[APP_LABEL]
991-
if instance.through_model_name not in app_models:
991+
model_name = through._meta.model_name
992+
if model_name not in app_models:
992993
apps.register_model(APP_LABEL, through)
993994
through_model = through
994995
else:
995-
through_model = apps.all_models[APP_LABEL][instance.through_model_name]
996+
through_model = apps.all_models[APP_LABEL][model_name]
996997

997998
# Update the M2M field's through model and target model
998999
field.remote_field.through = through_model

netbox_custom_objects/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def get_model(
496496
manytomany_models=None,
497497
app_label=None,
498498
skip_object_fields=False,
499-
no_cache=False,
499+
no_cache=True,
500500
_generating_models=None,
501501
):
502502
"""

0 commit comments

Comments
 (0)