adjust model name to IPAddressFunctionAssignments

This commit is contained in:
Jamie Murphy 2023-07-06 21:51:45 +01:00
parent 557c7d5f2e
commit 603f021465
5 changed files with 30 additions and 6 deletions

View File

@ -646,7 +646,7 @@ class Device(PrimaryModel, ConfigContextModel):
to='extras.ImageAttachment'
)
ipaddressfunctions = GenericRelation(
to='ipam.IPAddressFunction'
to='ipam.IPAddressFunctionAssignments'
)
objects = ConfigContextModelQuerySet.as_manager()
@ -1236,7 +1236,7 @@ class VirtualDeviceContext(PrimaryModel):
# Generic relation
ipaddressfunctions = GenericRelation(
to='ipam.IPAddressFunction'
to='ipam.IPAddressFunctionAssignments'
)
class Meta:

View File

@ -0,0 +1,23 @@
# Generated by Django 4.1.9 on 2023-07-06 20:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('extras', '0092_delete_jobresult'),
('contenttypes', '0002_remove_content_type_name'),
('ipam', '0067_ipaddressfunction_and_more'),
]
operations = [
migrations.RenameModel(
old_name='IPAddressFunction',
new_name='IPAddressFunctionAssignments',
),
migrations.AlterModelOptions(
name='ipaddressfunctionassignments',
options={'ordering': ('function',), 'verbose_name': 'IP Address Function Assignments'},
),
]

View File

@ -12,6 +12,7 @@ __all__ = (
'ASNRange',
'Aggregate',
'IPAddress',
'IPAddressFunctionAssignments',
'IPRange',
'FHRPGroup',
'FHRPGroupAssignment',

View File

@ -20,7 +20,7 @@ from netbox.models import OrganizationalModel, PrimaryModel, NetBoxModel
__all__ = (
'Aggregate',
'IPAddress',
'IPAddressFunction',
'IPAddressFunctionAssignments',
'IPRange',
'Prefix',
'RIR',
@ -668,7 +668,7 @@ class IPRange(PrimaryModel):
return int(float(child_count) / self.size * 100)
class IPAddressFunction(NetBoxModel):
class IPAddressFunctionAssignments(NetBoxModel):
assigned_object_type = models.ForeignKey(
to=ContentType,
limit_choices_to=IPADDRESS_FUNCTION_ASSIGNMENT_MODELS,
@ -694,7 +694,7 @@ class IPAddressFunction(NetBoxModel):
class Meta:
ordering = ('function',)
verbose_name = 'IP Address Function'
verbose_name = 'IP Address Function Assignments'
constraints = (
models.UniqueConstraint(
fields=('assigned_object_type', 'assigned_object_id', 'function'),

View File

@ -125,7 +125,7 @@ class VirtualMachine(PrimaryModel, ConfigContextModel):
to='tenancy.ContactAssignment'
)
ipaddressfunctions = GenericRelation(
to='ipam.IPAddressFunction'
to='ipam.IPAddressFunctionAssignments'
)
objects = ConfigContextModelQuerySet.as_manager()