Re: Warning in documentation about filtering queryset in ClassBasedViews

2022-10-30 Thread danigayo...@gmail.com
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

Re: Warning in documentation about filtering queryset in ClassBasedViews

2022-10-29 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
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

Re: Warning in documentation about filtering queryset in ClassBasedViews

2022-10-29 Thread David Sanders
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

Warning in documentation about filtering queryset in ClassBasedViews

2022-10-29 Thread Daniel Gayoso González
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