Reputation: 2641
I'm filtering against date in my get_queryset
parameter, I found something similar in official djangorestframework documentation, and I'm getting the result.
Now how can I limit this filter so I can only display data per date
, so for example when you select date it will show you some data for selected date, but it should not show you data from future dates, for now I'm showing all my contacts for today and that is fine, but I'm also showing all my contacts from the future and that is not fine, they should not be displayed, bottom line data should be visible per date
so how can I do that.
Currently I'm doing this:
filter_date = self.request.query_params.get('filter_date', None)
if filter_date is not None:
queryset = queryset.filter(next_action_date__gt=filter_date)
return queryset
next_action_date
is a DateField
:
next_action_date = models.DateField(blank=True, null=True)
Upvotes: 0
Views: 52