﻿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
34809	PyCharm typechecker complains	Nils Lindemann	nobody	"#30345 was closed, probably because it was not clear that the code will run, but the PyCharm type checker will complain. The solution posted there, namely, to write ...

{{{
return self.pub_date >= (timezone.now() - datetime.timedelta(days=1)).timestamp()
}}}

... instead of ...

{{{
return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
# PyCharm complains: ""Expected type 'timedelta', got 'DateTimeField' instead""
}}}

... will result in the correct type returned and PyCharm will not complain anymore.

[https://django.readthedocs.io/en/stable/intro/tutorial02.html#playing-with-the-api The related code example in the docs].

See also [https://stackoverflow.com/questions/61468142/pycharm-ide-warning-on-django-doc-expected-type-timedelta-got-datetimefield this Stack Overflow question]."	Uncategorized	closed	Documentation	4.2	Normal	duplicate			Unreviewed	0	0	0	0	0	0
