How to filter django queryset for a current week

Published: 13/01/2019
How to filter django queryset for a current week
Source: STACKOVERFLOW.COM

I am writing this customer admin filter that required to filter the queryset for this/current week only. How can I achieve this class WeekFilter(admin.SimpleListFilter): title = _("Week") parameter_name = "week" def lookups(self, request, model_admin): return ( ('1', 'This week'), ) def queryset(self, request, queryset): if self.value() == '1': return queryset.filter() # HERE I have trie

Read more
Related news
Comment
FACEBOOK