from django.template import Library import datetime register = Library() @register.filter def past_days(num_days): """ Returns a list of date objects for a given number of past days, including today. Useful for summaries of recent history. Usage: {% load past_days %}