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:
@@ -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])
|
||||
|
||||
|
Reference in New Issue
Block a user