Changeset 12d665f
- Timestamp:
- 02/11/10 14:03:12 (3 years ago)
- Branches:
- master, crem, crem2, dev, diadems, forma, generic, instru_search, lam, nlivemulti, production, release/1.4.4, security, social, storage, test, video
- Children:
- 96ab603
- Parents:
- c1a2c1c
- git-author:
- olivier <> (02/11/10 14:03:12)
- git-committer:
- olivier <> (02/11/10 14:03:12)
- File:
-
- 1 edited
-
telemeta/models/core.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
telemeta/models/core.py
r622588f r12d665f 145 145 146 146 default_error_messages = { 147 'invalid': _('Enter a valid duration in HH:MM[:ss [.uuuuuu]] format.'),147 'invalid': _('Enter a valid duration in HH:MM[:ss] format.'), 148 148 } 149 149 … … 151 151 super(DurationField, self).__init__(*args, **normalize_field(kwargs, '00:00')) 152 152 153 def get_internal_type(self):154 return ' TimeField'153 def db_type(self): 154 return 'int' 155 155 156 156 def to_python(self, value): 157 157 if value is None: 158 158 return None 159 if isinstance(value, int) or isinstance(value, long): 160 return Duration(seconds=value) 159 161 if isinstance(value, datetime.time): 160 162 return Duration(hours=value.hour, minutes=value.minute, seconds=value.second) … … 175 177 def get_db_prep_value(self, value, connection, prepared=False): 176 178 # Casts times into the format expected by the backend 177 return unicode(value)179 return value.as_seconds() 178 180 179 181 def value_to_string(self, obj):
Note: See TracChangeset
for help on using the changeset viewer.
