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

Use strings to specify prerequisite models

This commit is contained in:
jeremystretch
2022-11-16 17:22:09 -05:00
parent f411c4f439
commit ebf555e1fb
12 changed files with 61 additions and 86 deletions

View File

@@ -1,4 +1,3 @@
from django.apps import apps
from django.contrib.contenttypes.fields import GenericRelation, GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
@@ -95,6 +94,9 @@ class L2VPNTermination(NetBoxModel):
)
clone_fields = ('l2vpn',)
prerequisite_models = (
'ipam.L2VPN',
)
class Meta:
ordering = ('l2vpn',)
@@ -111,10 +113,6 @@ class L2VPNTermination(NetBoxModel):
return f'{self.assigned_object} <> {self.l2vpn}'
return super().__str__()
@classmethod
def get_prerequisite_models(cls):
return [apps.get_model('ipam.L2VPN'), ]
def get_absolute_url(self):
return reverse('ipam:l2vpntermination', args=[self.pk])