The day is the number a user will input to get the result that is older than (days from user input). For example, if user inputs 32 days, they will get the results that are
we can use Django timezone.now() with timedelta
from datetime import timedelta
from django.utils import timezone
time_threshold = timezone.now() - timedelta(days=7)
Entry.objects.filter(entered__gte=time_threshold)
Something like this would work for you:
from datetime import datetime, timedelta
how_many_days = 30
MyObject.objects.filter(entered__gte=datetime.now()-timedelta(days=how_many_days))
Add a timedelta(-30)
to the datetime
in the filter.