Ticket #7801: datetime_date_time_field_fix_8156.diff
File datetime_date_time_field_fix_8156.diff, 1.6 KB (added by , 16 years ago) |
---|
-
django/db/models/fields/__init__.py
548 548 return [oldforms.CommaSeparatedIntegerField] 549 549 550 550 class DateField(Field): 551 from django.db.models.fields.subclassing import SubfieldBase 552 __metaclass__ = SubfieldBase 553 551 554 empty_strings_allowed = False 552 555 def __init__(self, verbose_name=None, name=None, auto_now=False, auto_now_add=False, **kwargs): 553 556 self.auto_now, self.auto_now_add = auto_now, auto_now_add … … 617 620 return super(DateField, self).formfield(**defaults) 618 621 619 622 class DateTimeField(DateField): 623 from django.db.models.fields.subclassing import SubfieldBase 624 __metaclass__ = SubfieldBase 625 620 626 def get_internal_type(self): 621 627 return "DateTimeField" 622 628 … … 1106 1112 return super(TextField, self).formfield(**defaults) 1107 1113 1108 1114 class TimeField(Field): 1115 from django.db.models.fields.subclassing import SubfieldBase 1116 __metaclass__ = SubfieldBase 1117 1109 1118 empty_strings_allowed = False 1110 1119 def __init__(self, verbose_name=None, name=None, auto_now=False, auto_now_add=False, **kwargs): 1111 1120 self.auto_now, self.auto_now_add = auto_now, auto_now_add … … 1121 1130 return None 1122 1131 if isinstance(value, datetime.time): 1123 1132 return value 1133 if isinstance(value, datetime.datetime): 1134 return value.time() 1124 1135 1125 1136 # Attempt to parse a datetime: 1126 1137 value = smart_str(value)