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

Introduce PathContains lookup to allow filtering against objects in path directly

This commit is contained in:
Jeremy Stretch
2020-10-06 09:41:45 -04:00
parent 19430ddeb5
commit 56ee425227
6 changed files with 21 additions and 16 deletions

10
netbox/dcim/lookups.py Normal file
View File

@@ -0,0 +1,10 @@
from django.contrib.postgres.fields.array import ArrayContains
from dcim.utils import object_to_path_node
class PathContains(ArrayContains):
def get_prep_lookup(self):
self.rhs = [object_to_path_node(self.rhs)]
return super().get_prep_lookup()