Commits

Owen Nelson  committed 247cd9b

refactored to be more specific when handing __in lookups

  • Participants
  • Parent commits 833af8e

Comments (0)

Files changed (1)

File ipyfield/models.py

         return value.int()
 
     def get_prep_lookup(self, lookup_type, value):
-        value = self.to_python(value) # Ensure we have IP instance or None
         if lookup_type == 'exact':
             return self.get_prep_value(value)
         elif lookup_type == 'in':
+            if isinstance(value, str) and '/' in value:
+                # convert to CIDR iter
+                value = IP(value)
             return [self.get_prep_value(v) for v in value]
         else:
             raise TypeError('Lookup type %r not supported.' % lookup_type)