Commits

Matthew Schinckel committed a875804

Respect field.null

Comments (0)

Files changed (1)

timedelta/fields.py

             return value
         if isinstance(value, int):
             return datetime.timedelta(seconds=value)
+        if value == "":
+            return None
         return parse(value)
     
     def get_prep_value(self, value):
+        if self.null and value == "":
+            return None
         if (value is None) or isinstance(value, (str, unicode)):
             return value
         return str(value).replace(',', '')