Просмотр исходного кода

Removed deprecated CableQuerySet

Jeremy Stretch 7 лет назад
Родитель
Сommit
66ef5c726c
2 измененных файлов с 1 добавлено и 16 удалено
  1. 1 3
      netbox/dcim/models.py
  2. 0 13
      netbox/dcim/querysets.py

+ 1 - 3
netbox/dcim/models.py

@@ -22,7 +22,7 @@ from utilities.models import ChangeLoggedModel
 from utilities.utils import serialize_object, to_meters
 from .constants import *
 from .fields import ASNField, MACAddressField
-from .querysets import CableQuerySet, InterfaceQuerySet
+from .querysets import InterfaceQuerySet
 
 
 class ComponentTemplateModel(models.Model):
@@ -2435,8 +2435,6 @@ class Cable(ChangeLoggedModel):
         null=True
     )
 
-    objects = CableQuerySet.as_manager()
-
     csv_headers = [
         'termination_a_type', 'termination_a_id', 'termination_b_type', 'termination_b_id', 'type', 'status', 'label',
         'color', 'length', 'length_unit',

+ 0 - 13
netbox/dcim/querysets.py

@@ -69,16 +69,3 @@ class InterfaceQuerySet(QuerySet):
         wireless).
         """
         return self.exclude(form_factor__in=NONCONNECTABLE_IFACE_TYPES)
-
-
-class CableQuerySet(QuerySet):
-
-    def get_for_termination(self, termination):
-        """
-        Return the Cable (or None) connected to a given termination point.
-        """
-        content_type = ContentType.objects.get_for_model(termination)
-        return self.filter(
-            Q(termination_a_type=content_type, termination_a_id=termination.pk) |
-            Q(termination_b_type=content_type, termination_b_id=termination.pk)
-        ).first()