Yesterday,we ran into an issue that was due to a mysql bug on how we retrieve a queryset based on day and month .Example
A queryset to check if there are any open invoices for current month would be
import datetime current_date=datetime.datetime.today() Invoicer.objects.filter(is_open=True,from_date__month=current_date.month,from_date__year=current_date.year)
On the surface,this should return the 3 invoices,oddly an empty queryset is returned.
An empty queryset inadvertently means.No invoice exists hence generate a new one.
The error was due to MySQL configuration missing timezone data as suggested here
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot --force mysql -p
Despite the skipping error the queryset returned the three records instead of None