Fixes #1751: Corrected filtering for IPv6 addresses containing letters

This commit is contained in:
Jeremy Stretch
2017-12-05 16:10:45 -05:00
parent 9bc5075460
commit d60524d36f
2 changed files with 44 additions and 33 deletions

View File

@@ -13,12 +13,21 @@ class NetFieldDecoratorMixin(object):
return lhs_string, lhs_params
class IExact(NetFieldDecoratorMixin, lookups.IExact):
def get_rhs_op(self, connection, rhs):
return '= LOWER(%s)' % rhs
class EndsWith(NetFieldDecoratorMixin, lookups.EndsWith):
lookup_name = 'endswith'
pass
class IEndsWith(NetFieldDecoratorMixin, lookups.IEndsWith):
lookup_name = 'iendswith'
pass
def get_rhs_op(self, connection, rhs):
return 'LIKE LOWER(%s)' % rhs
class StartsWith(NetFieldDecoratorMixin, lookups.StartsWith):
@@ -26,15 +35,18 @@ class StartsWith(NetFieldDecoratorMixin, lookups.StartsWith):
class IStartsWith(NetFieldDecoratorMixin, lookups.IStartsWith):
lookup_name = 'istartswith'
pass
def get_rhs_op(self, connection, rhs):
return 'LIKE LOWER(%s)' % rhs
class Regex(NetFieldDecoratorMixin, lookups.Regex):
lookup_name = 'regex'
pass
class IRegex(NetFieldDecoratorMixin, lookups.IRegex):
lookup_name = 'iregex'
pass
class NetContainsOrEquals(Lookup):