diff --git a/settings.py b/settings.py index ab02a4542..7ab558960 100644 --- a/settings.py +++ b/settings.py @@ -146,6 +146,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( 'django.contrib.messages.context_processors.messages', 'trans.context_processors.version', 'trans.context_processors.title', + 'trans.context_processors.date', ) # A sample logging configuration. The only tangible logging diff --git a/trans/context_processors.py b/trans/context_processors.py index 1672770d4..2c2eed120 100644 --- a/trans/context_processors.py +++ b/trans/context_processors.py @@ -1,8 +1,16 @@ import trans from django.conf import settings +from datetime import datetime, date def version(request): return {'version': trans.VERSION} def title(request): return {'site_title': settings.SITE_TITLE} + +def date(request): + return { + 'current_date': datetime.utcnow().strftime('%Y-%m-%d'), + 'current_year': datetime.utcnow().strftime('%Y'), + 'current_month': datetime.utcnow().strftime('%m'), + }