Ticket #7801: datetime_date_time_field_fix_8156.diff

File datetime_date_time_field_fix_8156.diff, 1.6 KB (added by Andrew Magee <amagee@…>, 16 years ago)

updated patch

  • django/db/models/fields/__init__.py

     
    548548        return [oldforms.CommaSeparatedIntegerField]
    549549
    550550class DateField(Field):
     551    from django.db.models.fields.subclassing import SubfieldBase
     552    __metaclass__ = SubfieldBase
     553       
    551554    empty_strings_allowed = False
    552555    def __init__(self, verbose_name=None, name=None, auto_now=False, auto_now_add=False, **kwargs):
    553556        self.auto_now, self.auto_now_add = auto_now, auto_now_add
     
    617620        return super(DateField, self).formfield(**defaults)
    618621
    619622class DateTimeField(DateField):
     623    from django.db.models.fields.subclassing import SubfieldBase
     624    __metaclass__ = SubfieldBase
     625
    620626    def get_internal_type(self):
    621627        return "DateTimeField"
    622628
     
    11061112        return super(TextField, self).formfield(**defaults)
    11071113
    11081114class TimeField(Field):
     1115    from django.db.models.fields.subclassing import SubfieldBase
     1116    __metaclass__ = SubfieldBase
     1117
    11091118    empty_strings_allowed = False
    11101119    def __init__(self, verbose_name=None, name=None, auto_now=False, auto_now_add=False, **kwargs):
    11111120        self.auto_now, self.auto_now_add = auto_now, auto_now_add
     
    11211130            return None
    11221131        if isinstance(value, datetime.time):
    11231132            return value
     1133        if isinstance(value, datetime.datetime):
     1134            return value.time()
    11241135
    11251136        # Attempt to parse a datetime:
    11261137        value = smart_str(value)
Back to Top