Skip to content

Commit

Permalink
Fix bug in query of empty data
Browse files Browse the repository at this point in the history
  • Loading branch information
Werneror committed Nov 2, 2019
1 parent 8cd539e commit 6c22975
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cidrfield/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.0'
__version__ = '0.1.2'
2 changes: 2 additions & 0 deletions cidrfield/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def to_python(self, value):
raise ValidationError(error)

def from_db_value(self, value, expression, connection):
if value is None or len(value) < 5:
return None
prefix = value[:4]
value = value[4:-1] # remove prefix and %
if prefix == 'IPv4':
Expand Down

0 comments on commit 6c22975

Please sign in to comment.