1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Rename content_type_identifier() and content_type_name()

This commit is contained in:
Jeremy Stretch
2024-03-21 14:44:59 -04:00
parent ae8df77cc8
commit 8ad73e3f90
10 changed files with 38 additions and 37 deletions

View File

@@ -1,6 +1,6 @@
from django import forms
from utilities.utils import content_type_name
from utilities.utils import object_type_name
__all__ = (
'ContentTypeChoiceField',
@@ -17,7 +17,7 @@ class ContentTypeChoiceMixin:
def label_from_instance(self, obj):
try:
return content_type_name(obj)
return object_type_name(obj)
except AttributeError:
return super().label_from_instance(obj)

View File

@@ -5,7 +5,7 @@ from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from django.db.models import Q
from utilities.choices import unpack_grouped_choices
from utilities.utils import content_type_identifier
from utilities.utils import object_type_identifier
__all__ = (
'CSVChoiceField',
@@ -86,7 +86,7 @@ class CSVContentTypeField(CSVModelChoiceField):
STATIC_CHOICES = True
def prepare_value(self, value):
return content_type_identifier(value)
return object_type_identifier(value)
def to_python(self, value):
if not value:
@@ -115,4 +115,4 @@ class CSVMultipleContentTypeField(forms.ModelMultipleChoiceField):
app_label, model = name.split('.')
ct_filter |= Q(app_label=app_label, model=model)
return list(ContentType.objects.filter(ct_filter).values_list('pk', flat=True))
return content_type_identifier(value)
return object_type_identifier(value)