Ticket #23420: datetime_unbound_warning.patch

File datetime_unbound_warning.patch, 1.1 KB (added by Andy Chosak, 10 years ago)
  • django/db/models/fields/__init__.py

    diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
    index c41d4ea..1c24c7c 100644
    a b class DateTimeField(DateField):  
    14001400            # For backwards compatibility, interpret naive datetimes in local
    14011401            # time. This won't work during DST change, but we can't do much
    14021402            # about it, so we let the exceptions percolate up the call stack.
    1403             warnings.warn("DateTimeField %s.%s received a naive datetime (%s)"
     1403            name = '%s.%s' % (self.model.__name__, self.name) \
     1404                if hasattr(self, 'model') else '(unbound)'
     1405            warnings.warn("DateTimeField %s received a naive datetime (%s)"
    14041406                          " while time zone support is active." %
    1405                           (self.model.__name__, self.name, value),
     1407                          (name, value),
    14061408                          RuntimeWarning)
    14071409            default_timezone = timezone.get_default_timezone()
    14081410            value = timezone.make_aware(value, default_timezone)
Back to Top