Commit 8aa156e5 by Bach Dániel

firewall: fix IPAddressField (flags=ZEROFILL)

parent 1b86ea7f
...@@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _ ...@@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _
from django.utils.ipv6 import is_valid_ipv6_address from django.utils.ipv6 import is_valid_ipv6_address
from south.modelsinspector import add_introspection_rules from south.modelsinspector import add_introspection_rules
from django import forms from django import forms
from netaddr import IPAddress, IPNetwork, AddrFormatError from netaddr import IPAddress, IPNetwork, AddrFormatError, ZEROFILL
import re import re
...@@ -77,7 +77,8 @@ class IPAddressField(models.Field): ...@@ -77,7 +77,8 @@ class IPAddressField(models.Field):
if isinstance(value, IPAddress): if isinstance(value, IPAddress):
return value return value
return IPAddress(value.split('/')[0], version=version) return IPAddress(value.split('/')[0], version=version,
flags=ZEROFILL)
def get_internal_type(self): def get_internal_type(self):
return "CharField" return "CharField"
......
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