I have a model with field "created_at", and I have a list of dates. So, I want to get all the models that are created in the date range. How ?
I know that we can compare datetime and date easily using:
queryset.filter(created_at__startswith=date)
But, I have a range of dates, so how ?
Let me know for more information.
Django Q is a native Django task queue, scheduler and worker application using Python multiprocessing.
Django-filter is a generic, reusable application to alleviate writing some of the more mundane bits of view code. Specifically, it allows users to filter down a queryset based on a model's fields, displaying the form to let them do this. Adding a FilterSet with filterset_class. Using the filterset_fields shortcut.
You can combine date and range field lookups:
queryset.filter(created_at__date__range=(start_date, end_date))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With