I will try to explain, although I am not a good teacher.

Suppose you have an 'Example' model that has a 'data' field with
'auto_now_add = True'
And a function 'yesterday()' that returns yesterday, and 'past()' that
returns 'yesterday() minus some days'.

if you want to filter items between yesterday() and past(), you could
use something like:
Example.objects.filter(data__gte=past(),data__lte=yesterday())

 or using .exclude too

If you need more info, you can get better in django docs:
https://docs.djangoproject.com/en/3.1/ref/models/querysets/

I hope I helped a little despite my bad English.






Em qua., 3 de fev. de 2021 às 10:24, Eugene TUYIZERE <
eugenetuyiz...@gmail.com> escreveu:

> Dear Thiago,
>
> Can I have some documentations or sample codes please?
>
> On Wed, 3 Feb 2021 at 15:16, Thiago Luiz Parolin <thiago.paro...@unesp.br>
> wrote:
>
>> Hi...
>> Normally i use field__lte and field__gte
>>
>> Em qua, 3 de fev de 2021 08:11, Eugene TUYIZERE <eugenetuyiz...@gmail.com>
>> escreveu:
>>
>>> Dear Team,
>>>
>>> I need help. I have a list of Items in a table. And I want to filter
>>> some data between dates (start and end date). Please help me to do a search
>>> between the two date. I am using Data table but I can use the other way if
>>> possible for this purpose.
>>>
>>> Regards,
>>>
>>> --
>>> *TUYIZERE Eugene*
>>>
>>>
>>>
>>> *Msc Degree in Mathematical Science*
>>>
>>> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
>>> Garden-Lime, Cameroon*
>>>
>>> Bsc in Computer Science
>>>
>>> *UR-Nyagatare Campus*
>>>
>>> Email: eugene.tuyiz...@aims-cameroon.org
>>>            eugenetuyiz...@gmail.com
>>>
>>> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>>>
>>> --
>>> 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+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CABxpZHuPozCVEUFjWFYxipwTyGrY9Syyw-Et%2B_NAqXn6GevNow%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CABxpZHuPozCVEUFjWFYxipwTyGrY9Syyw-Et%2B_NAqXn6GevNow%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CANbmKytQ%3D1hiSQyj5%2Bkj-Dvy2Tk%2B0YUukORMui0cP7BPwXNZdg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CANbmKytQ%3D1hiSQyj5%2Bkj-Dvy2Tk%2B0YUukORMui0cP7BPwXNZdg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> *TUYIZERE Eugene*
>
>
>
> *Msc Degree in Mathematical Science*
>
> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
> Garden-Lime, Cameroon*
>
> Bsc in Computer Science
>
> *UR-Nyagatare Campus*
>
> Email: eugene.tuyiz...@aims-cameroon.org
>            eugenetuyiz...@gmail.com
>
> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABxpZHsJ9%3DE-cQX4iNQxc8ztP2Hcd%3DC4stZfA3KhMwXrTekxjQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABxpZHsJ9%3DE-cQX4iNQxc8ztP2Hcd%3DC4stZfA3KhMwXrTekxjQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Thiago Luiz Parolin

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANbmKyvfMe8d1uekPSCqjr_Mf5eqpSnU3zFBXZcfDVt7XMzNjw%40mail.gmail.com.

Reply via email to