diff --git a/re2o/context_processors.py b/re2o/context_processors.py index a2e205c2..ceb03be2 100644 --- a/re2o/context_processors.py +++ b/re2o/context_processors.py @@ -21,8 +21,10 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. """Fonction de context, variables renvoyées à toutes les vues""" - from __future__ import unicode_literals + +import datetime + from django.contrib import messages from preferences.models import GeneralOption, OptionalMachine @@ -47,3 +49,12 @@ def context_user(request): 'name_website': GeneralOption.get_cached_value('site_name'), 'ipv6_enabled': OptionalMachine.get_cached_value('ipv6'), } + + +def date_now(request): + """Add the current date in the context for quick informations and + comparisons""" + return { + 'now_aware': datetime.datetime.now(datetime.timezone.utc), + 'now_naive': datetime.datetime.now() + } diff --git a/re2o/settings.py b/re2o/settings.py index 1117dd77..71bd266f 100644 --- a/re2o/settings.py +++ b/re2o/settings.py @@ -125,6 +125,7 @@ TEMPLATES = [ 'django.contrib.messages.context_processors.messages', 'django.template.context_processors.request', 're2o.context_processors.context_user', + 're2o.context_processors.date_now', ], }, }, diff --git a/users/templates/users/aff_listright.html b/users/templates/users/aff_listright.html index e7d3e64a..f4ed1e83 100644 --- a/users/templates/users/aff_listright.html +++ b/users/templates/users/aff_listright.html @@ -70,7 +70,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% for user in superusers %}