1. Felipe Prenholato
  2. django-timedelta-field

Commits

reidpr  committed fa7fbd0

turn the empty string into None instead of 0:00:00 if null is allowed

  • Participants
  • Parent commits 524f8c6
  • Branches default

Comments (0)

Files changed (1)

File timedelta/fields.py

View file
         if isinstance(value, int):
             return datetime.timedelta(seconds=value)
         if value == "":
-            return datetime.timedelta(0)
+            if self.null:
+                return None
+            else:
+                return datetime.timedelta(0)
         return parse(value)
     
     def get_prep_value(self, value):