﻿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
29726	Setting the Shanghai time zone causes a query error	AberSheeran	nobody	"I have a little website. It's settings.py like this

{{{
LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Shanghai'

USE_I18N = True

USE_L10N = True

USE_TZ = True
}}}

And then, I had saved some data in SQLite3. But get a error


{{{
>>> for each in Message.objects.all():
...     print(each.create_time.year, each.create_time.month)
... 
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
2018 8
>>> for each in Message.objects.filter(create_time__year=""2018"", create_time__month=""09""):
...     print(each.create_time.year, each.create_time.month)
... 
2018 8
2018 8
2018 8
>>> 
}}}

These three messages were sent in the last eight hours of August 31, 2018 UTC. The result of querying through .all() is UTC time. But the result of querying through .filter() is Asia/Shanghai time. This brings me some trouble...


"	Bug	closed	Database layer (models, ORM)	2.1	Normal	invalid			Unreviewed	0	0	0	0	0	0
