|
32 | 32 | from utilities.templatetags.builtins.filters import linkify, render_markdown
|
33 | 33 |
|
34 | 34 | 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 |
36 | 36 |
|
37 | 37 |
|
38 | 38 | class FieldType:
|
@@ -344,7 +344,7 @@ def get_model_field(self, field, **kwargs):
|
344 | 344 | if content_type.app_label == APP_LABEL:
|
345 | 345 | from netbox_custom_objects.models import CustomObjectType
|
346 | 346 |
|
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( |
348 | 348 | content_type
|
349 | 349 | )
|
350 | 350 | 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):
|
372 | 372 | # This is a custom object type
|
373 | 373 | from netbox_custom_objects.models import CustomObjectType
|
374 | 374 |
|
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( |
376 | 376 | content_type
|
377 | 377 | )
|
378 | 378 | custom_object_type = CustomObjectType.objects.get(pk=custom_object_type_id)
|
@@ -579,7 +579,7 @@ def get_through_model(self, field, model=None):
|
579 | 579 |
|
580 | 580 | # Check if this is a self-referential M2M
|
581 | 581 | 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) |
583 | 583 | is_self_referential = (
|
584 | 584 | content_type.app_label == APP_LABEL
|
585 | 585 | and field.custom_object_type.id == custom_object_type_id
|
@@ -614,7 +614,7 @@ def get_model_field(self, field, **kwargs):
|
614 | 614 | """
|
615 | 615 | # Check if this is a self-referential M2M
|
616 | 616 | 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) |
618 | 618 | # TODO: Default does not auto-populate, to new or existing objects (should it?)
|
619 | 619 | kwargs.update({"default": field.default, "unique": field.unique})
|
620 | 620 |
|
@@ -655,7 +655,7 @@ def get_form_field(self, field, for_csv_import=False, **kwargs):
|
655 | 655 | # This is a custom object type
|
656 | 656 | from netbox_custom_objects.models import CustomObjectType
|
657 | 657 |
|
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( |
659 | 659 | content_type
|
660 | 660 | )
|
661 | 661 | custom_object_type = CustomObjectType.objects.get(pk=custom_object_type_id)
|
@@ -717,7 +717,7 @@ def after_model_generation(self, instance, model, field_name):
|
717 | 717 | if content_type.app_label == APP_LABEL:
|
718 | 718 | from netbox_custom_objects.models import CustomObjectType
|
719 | 719 |
|
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( |
721 | 721 | content_type
|
722 | 722 | )
|
723 | 723 | custom_object_type = CustomObjectType.objects.get(pk=custom_object_type_id)
|
@@ -759,7 +759,7 @@ def create_m2m_table(self, instance, model, field_name):
|
759 | 759 | if content_type.app_label == APP_LABEL:
|
760 | 760 | from netbox_custom_objects.models import CustomObjectType
|
761 | 761 |
|
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( |
763 | 763 | content_type
|
764 | 764 | )
|
765 | 765 | custom_object_type = CustomObjectType.objects.get(
|
|
0 commit comments