Rename ContentType proxy model to ObjectType

This commit is contained in:
Jeremy Stretch
2024-03-01 11:47:46 -05:00
parent c6a3fc2407
commit 0df68bf291
20 changed files with 91 additions and 93 deletions

View File

@@ -1,7 +1,7 @@
from django import forms
from django.utils.translation import gettext_lazy as _
from core.models import ContentType
from core.models import ObjectType
from netbox.forms import NetBoxModelFilterSetForm
from tenancy.choices import *
from tenancy.models import *
@@ -86,7 +86,7 @@ class ContactAssignmentFilterForm(NetBoxModelFilterSetForm):
(_('Assignment'), ('content_type_id', 'group_id', 'contact_id', 'role_id', 'priority')),
)
content_type_id = ContentTypeMultipleChoiceField(
queryset=ContentType.objects.with_feature('contacts'),
queryset=ObjectType.objects.with_feature('contacts'),
required=False,
label=_('Object type')
)

View File

@@ -4,7 +4,7 @@ from django.db import models
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from core.models import ContentType
from core.models import ObjectType
from netbox.models import ChangeLoggedModel, NestedGroupModel, OrganizationalModel, PrimaryModel
from netbox.models.features import CustomFieldsMixin, ExportTemplatesMixin, TagsMixin
from tenancy.choices import *
@@ -165,7 +165,7 @@ class ContactAssignment(CustomFieldsMixin, ExportTemplatesMixin, TagsMixin, Chan
super().clean()
# Validate the assigned object type
if self.content_type not in ContentType.objects.with_feature('contacts'):
if self.content_type not in ObjectType.objects.with_feature('contacts'):
raise ValidationError(
_("Contacts cannot be assigned to this object type ({type}).").format(type=self.content_type)
)