Include date in context
This commit is contained in:
parent
ce1fe7116b
commit
de882df442
@ -146,6 +146,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
|||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
'trans.context_processors.version',
|
'trans.context_processors.version',
|
||||||
'trans.context_processors.title',
|
'trans.context_processors.title',
|
||||||
|
'trans.context_processors.date',
|
||||||
)
|
)
|
||||||
|
|
||||||
# A sample logging configuration. The only tangible logging
|
# A sample logging configuration. The only tangible logging
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
import trans
|
import trans
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from datetime import datetime, date
|
||||||
|
|
||||||
def version(request):
|
def version(request):
|
||||||
return {'version': trans.VERSION}
|
return {'version': trans.VERSION}
|
||||||
|
|
||||||
def title(request):
|
def title(request):
|
||||||
return {'site_title': settings.SITE_TITLE}
|
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'),
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user