Skip to content

Commit 2149eb2

Browse files
committed
fix ruff and init check
1 parent a8a7381 commit 2149eb2

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

netbox_custom_objects/__init__.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,12 @@ def ready(self):
7878
super().ready()
7979

8080
def get_model(self, model_name, require_ready=True):
81-
if "table" in model_name.lower() and "model" in model_name.lower():
82-
is_custom_object_model = True
83-
else:
84-
is_custom_object_model = False
85-
8681
self.apps.check_apps_ready()
87-
if not is_custom_object_model:
88-
try:
89-
# if the model is already loaded, return it
90-
return super().get_model(model_name, require_ready)
91-
except LookupError:
92-
try:
93-
self.apps.check_apps_ready()
94-
except AppRegistryNotReady:
95-
raise
82+
try:
83+
# if the model is already loaded, return it
84+
return super().get_model(model_name, require_ready)
85+
except LookupError:
86+
pass
9687

9788
model_name = model_name.lower()
9889
# only do database calls if we are sure the app is ready to avoid

netbox_custom_objects/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,6 @@ def get_model(
524524
# Add this model to the set of models being generated
525525
_generating_models.add(self.id)
526526

527-
app_models = apps.all_models[APP_LABEL]
528527
model_name = self.get_table_model_name(self.pk)
529528

530529
# TODO: Add other fields with "index" specified

0 commit comments

Comments
 (0)