Include date in context

This commit is contained in:
Michal Čihař 2012-03-05 14:47:10 +01:00
parent ce1fe7116b
commit de882df442
2 changed files with 9 additions and 0 deletions

View File

@ -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

View File

@ -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'),
}