I thought that it would a good idea to point this because it is a bug that
you will not catch until production stage, but I guess time dependant
queries are prone to this and require experience.
After reading your comments I realize this is more a python problem than a
Django one, as both of yo
I'm inclined to agree with David here. This is a “understanding Python”
thing. We can’t feasibly add documentation warnings everywhere such a
mistake could be made.
On Sat, Oct 29, 2022 at 8:00 PM David Sanders
wrote:
> Hi Daniel,
>
> I don't think a warning is necessary here as it's fairly stan
Hi Daniel,
I don't think a warning is necessary here as it's fairly standard Python.
To explain: the timezone.now() is evaluated at module level – ie only once
when the Python module is imported – which explains the behaviour that
you're experiencing.
If you like you can submit a documentation P
Hello,
Following the example in
https://docs.djangoproject.com/en/4.1/topics/class-based-views/generic-display/#viewing-subsets-of-objects
I tried the following
class BookListView(ListView):
model = Book
queryset = Book.objects.filter(publication_date__lte=timezone.now())
I found that th