Changes between Initial Version and Version 1 of Ticket #22536
- 04/28/14 15:50:11 (22 months ago)
- Property Patch needs improvement unset
- Property Triage Stage changed from Unreviewed to Accepted
- Property Needs tests unset
- Property Needs documentation unset
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, 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.