mamweb/various/context_processors.py
Pavel "LEdoian" Turinsky a68e04abe0 Apríl není pořád :-D
2021-03-31 21:41:14 +02:00

14 lines
302 B
Python

def april(req):
if 'X-April' in req.headers:
try:
year = int(req.headers['X-April'])
return {'april': year}
except:
pass # Fall-back to regular behaviour
import datetime
today = datetime.date.today()
if today.day == 1 and today.month == 4:
return {'april': today.year}
return {}