Filter questions with dates

42 views
Skip to first unread message

Lakshyaraj Dash

unread,
Oct 26, 2022, 12:02:16 AM10/26/22
to django...@googlegroups.com
I'm having a forums project in which I want to add a date filter for questions like when a user clicks on a specific date the questions related to the date will be filter like 24 Dec 2021 will show 24122022...

Ryan Nowakowski

unread,
Oct 27, 2022, 10:04:24 AM10/27/22
to django...@googlegroups.com
Do you already have other kinds of filters in place and just need help adding a date filter, or do you need help with filtering in general?

Lakshyaraj Dash

unread,
Oct 27, 2022, 10:09:00 AM10/27/22
to django...@googlegroups.com
I have search filters and tagwise filters and just want to add date filters.

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/BD9E1263-A0CE-4467-8966-72BB3EF755EC%40fattuba.com.

Ryan Nowakowski

unread,
Oct 28, 2022, 9:35:10 AM10/28/22
to django...@googlegroups.com
Is your question around how to do the date filtering in the view or how to set up the filter in the template?

Lakshyaraj Dash

unread,
Oct 28, 2022, 10:23:31 AM10/28/22
to django...@googlegroups.com
I want a select menu with months and years written against the corresponding month. When I will click the filter button the blogs should be filtered with the corresponding month and year.

Ryan Nowakowski

unread,
Oct 29, 2022, 8:35:05 AM10/29/22
to django...@googlegroups.com, Lakshyaraj Dash
To generate the list of years for your select you can use dates [1].

[1] https://docs.djangoproject.com/en/dev/ref/models/querysets/#dates

Vitaly Bogomolov

unread,
Oct 29, 2022, 11:25:53 AM10/29/22
to Django users
You can try to use DateRange or DateRangePicker filter from my DjangoAdminFilters library.

django-filters.PNG


пятница, 28 октября 2022 г. в 18:23:31 UTC+4, dashlaksh...@gmail.com:

M Adnan

unread,
Oct 29, 2022, 11:36:38 AM10/29/22
to django...@googlegroups.com
Filter as created_at__lte or created_at__gte it's depends on your requirements 

Lakshyaraj Dash

unread,
Oct 29, 2022, 11:41:42 AM10/29/22
to django...@googlegroups.com
Dear Vitaly,
I want the filters using form select field in my template no in the admin 

Reply all
Reply to author
Forward
0 new messages