Parcourir la source

Fix casting in form to_python() method

NetAddressFormField.to_python() was calling "self.python_type()" to
cast the form value to an IP() object. Unfortunately, for is no such
method defined here, or in the Django forms.Field() class, at least
in 1.4 and up
jimfunk il y a 12 ans
Parent
commit
cf026dbabf
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      netfields/forms.py

+ 1 - 1
netfields/forms.py

@@ -35,7 +35,7 @@ class NetAddressFormField(forms.Field):
         if isinstance(value, IP):
             return value
 
-        return self.python_type(value)
+        return IP(value)
 
 
 MAC_RE = re.compile(r'^(([A-F0-9]{2}:){5}[A-F0-9]{2})$')