﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24076	Query may fail with pytz exception	lvella	Adam Zapletal	"If I give date object as input to a filter on a DateTimeField field, like this:

{{{
class Ticket(models.Model):
    register_time = models.DateTimeField(auto_now_add=True)

day = datetime.strptime('2014-10-19', '%Y-%m-%d').date()
Ticket.objects.filter(register_time__gte=day)
}}}

I may get a pytz.exceptions.NonExistentTimeError exception. The exact exception was:

pytz.exceptions.NonExistentTimeError: 2014-10-19 00:00:00

This date is the start of DST in my timezone:

{{{
TIME_ZONE = 'America/Sao_Paulo'
}}}

I believe this is a bug because Django tries to convert my input to a datetime object before building the query, and in this case, this conversion yields an invalid datetime.

This bug seems very related to issue #9596, because in these cases, datetime should be converted to date, not the opposite.

A minimal showcase is attached. Unzip and run ./manage.py test"	Bug	closed	Documentation	1.6	Normal	fixed		Adam Zapletal	Ready for checkin	1	0	0	0	0	0
