Ticket #5714: newforms-datetime-strip.diff
File newforms-datetime-strip.diff, 1.2 KB (added by , 17 years ago) |
---|
-
django/newforms/fields.py
237 237 return value.date() 238 238 if isinstance(value, datetime.date): 239 239 return value 240 if isinstance(value, basestring): 241 value = value.strip() 240 242 for format in self.input_formats: 241 243 try: 242 244 return datetime.date(*time.strptime(value, format)[:3]) … … 264 266 return None 265 267 if isinstance(value, datetime.time): 266 268 return value 269 if isinstance(value, basestring): 270 value = value.strip() 267 271 for format in self.input_formats: 268 272 try: 269 273 return datetime.time(*time.strptime(value, format)[3:6]) … … 300 304 return value 301 305 if isinstance(value, datetime.date): 302 306 return datetime.datetime(value.year, value.month, value.day) 307 if isinstance(value, basestring): 308 value = value.strip() 303 309 for format in self.input_formats: 304 310 try: 305 311 return datetime.datetime(*time.strptime(value, format)[:6])