Would it be possible to support resolving RHS expressions in the custom lookups?
# query to find devices whose IP is not assigned to an interface
(
Device.objects
.prefetch_related('interface')
.filter(
~Q(interface__interface_address__net_contains=F('ip_address'))
)
.values('name', 'ip_address')
)
They appear to pass through as a literal.
Col(networks_device, networks.Device.ip_address) does not appear to be an IPv4 or IPv6 interface.
Looking at the django source, they appear to have some boilerplate that may work.
def get_prep_lookup(self):
if hasattr(self.rhs, 'resolve_expression'):
return self.rhs
if self.prepare_rhs and hasattr(self.lhs.output_field, 'get_prep_value'):
return self.lhs.output_field.get_prep_value(self.rhs)
return self.rhs
If I get some time at the end of my sprint, I will see if I can work on this, but I wanted to at least get it documented.
Would it be possible to support resolving RHS expressions in the custom lookups?
They appear to pass through as a literal.
Looking at the django source, they appear to have some boilerplate that may work.
If I get some time at the end of my sprint, I will see if I can work on this, but I wanted to at least get it documented.
Thank you.