Commit 9325cf03 by Bach Dániel

firewall: fix missing prefix in IPNetworkField.get_db_prep_value()

parent 019f5766
......@@ -91,9 +91,9 @@ class IPNetworkField(models.Field):
if isinstance(value, IPNetwork):
if self.version == 4:
return '.'.join(map(lambda x: "%03d" % x, value.ip.words))
return '.'.join(map(lambda x: "%03d" % x, value.ip.words)) + '/%d' % value.prefixlen
else:
return ':'.join(map(lambda x: "%04X" % x, value.ip.words))
return ':'.join(map(lambda x: "%04X" % x, value.ip.words)) + '/%d' % value.prefixlen
return value
def value_to_string(self, obj):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment