blob: 36b1bcfbe5dfb8fbee0fb9238852e858ee18dd10 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
from datetime import date
from django.utils.timesince import timesince
# Take Django's DOB as from the first public blog post.
# https://www.djangoproject.com/weblog/2005/jul/14/prelaunch/
DJANGO_DOB = date(2005, 7, 14)
def community_stats(request):
"""
Context processor to calculate Django's age for the community pages.
"""
# Django 3.2 introduces depth kwarg. Set timesince(..., depth=1) then.
stats = {"age": timesince(DJANGO_DOB)}
return {"community_stats": stats}
|