]> git.parisson.com Git - teleforma.git/commitdiff
Fix duration field
authortest test <yoanl@pilotsystems.net>
Thu, 3 Jun 2021 15:37:44 +0000 (17:37 +0200)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 12 Apr 2023 09:46:25 +0000 (11:46 +0200)
teleforma/fields.py

index a786730a1db48709845d2d8cb5588a04453dafdd..03e89a710f001bb6dd7d29fde0b0d4553974c6cc 100644 (file)
@@ -48,7 +48,6 @@ class Duration(object):
         hours   = self._delta.days * 24 + self._delta.seconds / 3600
         minutes = (self._delta.seconds % 3600) / 60
         seconds = self._delta.seconds % 60
-
         return "%.2d:%.2d:%.2d" % (hours, minutes, seconds)
 
     @staticmethod
@@ -163,6 +162,9 @@ class DurationField(models.Field):
             data = str(val)
         return data
 
+    def from_db_value(self, value, expression, connection):
+        return self.to_python(value)
+
     def formfield(self, **kwargs):
         defaults = {'form_class': forms.CharField}
         defaults.update(kwargs)