Changes between Initial Version and Version 1 of Ticket #22536
- Timestamp:
- Apr 28, 2014, 3:50:11 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #22536
- Property Triage Stage Unreviewed → Accepted
-
Ticket #22536 – Description
initial v1 1 1 I ran into a non-obvious exception while using the date-based generic views. get_previous_day / get_next_day were raising an AttributeError ('NoneType' object has no attribute 'astimezone') in the following code when the view was called with the earliest item in the system: 2 2 3 {{{ 3 4 try: 4 5 result = getattr(qs[0], date_field) … … 11 12 result = timezone.localtime(result) 12 13 result = result.date() 13 14 }}} 14 15 15 16 This error wasn't immediately obvious because the query shouldn't have been able to return a NULL. Looking at the data revealed the problem: a small number of records on my test instance had invalid dates in MySQL (0000-00-00) which were included by the __lt query but subsequently converted into None by the ORM.