Wednesday, February 1, 2017

Re: Possible bug in queryset "gte" function

Your date field is probably a date-time field in your database.
So your filter is going to be looking for 2016-12-03 00:00:00 thru 2016-12-04 00:00:00.

Dylan


On Wed, Feb 1, 2017 at 6:16 AM, <jjddgg9999@gmail.com> wrote:
Hi, guys.

If I'm not madly blind (which has been the case before, you know), there is a bug in the "__gte" function for the orm queryset. To name it, whenever I call the function, it gives the same result that the "__gt" function, that is, greater than or equal to, is behaving the same as greater than. 

In my specific case, I want to do a query over my database that return the rows registered between the 3th of december and the 4th, for which I have written:

Warehouse.objects.filter(date__gte="2016-12-03", date__lte="2016-12-04")

such queryset returns an empty set, even though I know there are registers within those two dates. Then I checked, and did only:

Warehouse.objects.filter(date__gte="2016-12-03")

and it returned rows with dates 2016-12-04 and higher, so... well, that the bug as far I can see.

Thanks for your replies and if someone can directly verify and report the bug, that would be awesome. 

Thanks.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2109d071-2065-4ebe-8608-6bdc30d0e64e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHtg44AFWBeVBEpiwpOLrW8%2BjmSTE0wPF4ErjWbSyC2VEY-qjA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment