Skip to content

Commit c7392d3

Browse files
committed
rename
1 parent 13eb53d commit c7392d3

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

netbox_custom_objects/field_types.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from utilities.templatetags.builtins.filters import linkify, render_markdown
3333

3434
from netbox_custom_objects.constants import APP_LABEL
35-
from netbox_custom_objects.utilities import get_custom_object_type_from_content_type
35+
from netbox_custom_objects.utilities import get_custom_object_type_id_from_content_type
3636

3737

3838
class FieldType:
@@ -344,7 +344,7 @@ def get_model_field(self, field, **kwargs):
344344
if content_type.app_label == APP_LABEL:
345345
from netbox_custom_objects.models import CustomObjectType
346346

347-
custom_object_type_id = get_custom_object_type_from_content_type(
347+
custom_object_type_id = get_custom_object_type_id_from_content_type(
348348
content_type
349349
)
350350
custom_object_type = CustomObjectType.objects.get(pk=custom_object_type_id)
@@ -372,7 +372,7 @@ def get_form_field(self, field, for_csv_import=False, **kwargs):
372372
# This is a custom object type
373373
from netbox_custom_objects.models import CustomObjectType
374374

375-
custom_object_type_id = get_custom_object_type_from_content_type(
375+
custom_object_type_id = get_custom_object_type_id_from_content_type(
376376
content_type
377377
)
378378
custom_object_type = CustomObjectType.objects.get(pk=custom_object_type_id)
@@ -579,7 +579,7 @@ def get_through_model(self, field, model=None):
579579

580580
# Check if this is a self-referential M2M
581581
content_type = ContentType.objects.get(pk=field.related_object_type_id)
582-
custom_object_type_id = get_custom_object_type_from_content_type(content_type)
582+
custom_object_type_id = get_custom_object_type_id_from_content_type(content_type)
583583
is_self_referential = (
584584
content_type.app_label == APP_LABEL
585585
and field.custom_object_type.id == custom_object_type_id
@@ -614,7 +614,7 @@ def get_model_field(self, field, **kwargs):
614614
"""
615615
# Check if this is a self-referential M2M
616616
content_type = ContentType.objects.get(pk=field.related_object_type_id)
617-
custom_object_type_id = get_custom_object_type_from_content_type(content_type)
617+
custom_object_type_id = get_custom_object_type_id_from_content_type(content_type)
618618
# TODO: Default does not auto-populate, to new or existing objects (should it?)
619619
kwargs.update({"default": field.default, "unique": field.unique})
620620

@@ -655,7 +655,7 @@ def get_form_field(self, field, for_csv_import=False, **kwargs):
655655
# This is a custom object type
656656
from netbox_custom_objects.models import CustomObjectType
657657

658-
custom_object_type_id = get_custom_object_type_from_content_type(
658+
custom_object_type_id = get_custom_object_type_id_from_content_type(
659659
content_type
660660
)
661661
custom_object_type = CustomObjectType.objects.get(pk=custom_object_type_id)
@@ -717,7 +717,7 @@ def after_model_generation(self, instance, model, field_name):
717717
if content_type.app_label == APP_LABEL:
718718
from netbox_custom_objects.models import CustomObjectType
719719

720-
custom_object_type_id = get_custom_object_type_from_content_type(
720+
custom_object_type_id = get_custom_object_type_id_from_content_type(
721721
content_type
722722
)
723723
custom_object_type = CustomObjectType.objects.get(pk=custom_object_type_id)
@@ -759,7 +759,7 @@ def create_m2m_table(self, instance, model, field_name):
759759
if content_type.app_label == APP_LABEL:
760760
from netbox_custom_objects.models import CustomObjectType
761761

762-
custom_object_type_id = get_custom_object_type_from_content_type(
762+
custom_object_type_id = get_custom_object_type_id_from_content_type(
763763
content_type
764764
)
765765
custom_object_type = CustomObjectType.objects.get(

netbox_custom_objects/utilities.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
__all__ = (
66
"AppsProxy",
7-
"get_custom_object_type_from_content_type",
7+
"get_custom_object_type_id_from_content_type",
88
"get_viewname",
99
)
1010

@@ -86,5 +86,5 @@ def get_viewname(model, action=None, rest_api=False):
8686
return viewname
8787

8888

89-
def get_custom_object_type_from_content_type(content_type):
89+
def get_custom_object_type_id_from_content_type(content_type):
9090
return int(content_type.model.replace("table", "").replace("model", ""))

0 commit comments

Comments
 (0)