Files @ 70d6eb7140c7
Branch filter:

Location: website/www/podjango/templatetags/date_within.py

bsturmfels
podjango: Link up "The Corresponding Source" title

This helps with navigating back to the home page.
1
2
3
4
5
6
7
8
9
from django import template
from datetime import timedelta, datetime

register = template.Library()

@register.filter
def date_within_past_days(value, arg):
    # question: does datetime.now() do a syscall each time is it called?
    return value > (datetime.now() - timedelta(days=int(arg)))