From 5ccc35bba01c9f9f67d436cd104fdecfc9288f22 Mon Sep 17 00:00:00 2001 From: Emilie Date: Thu, 20 Oct 2016 17:08:39 +0200 Subject: [PATCH] Event : add archives --- app/local_settings.py | 6 ++++++ app/organization/core/context_processors.py | 7 +++++++ app/settings.py | 5 ++++- app/templates/agenda/event_list.html | 21 ++++++++++++--------- app/templates/home/inc/services.html | 2 +- 5 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 app/organization/core/context_processors.py diff --git a/app/local_settings.py b/app/local_settings.py index 466df445..6eb1db2c 100644 --- a/app/local_settings.py +++ b/app/local_settings.py @@ -1,5 +1,6 @@ import os from django.utils.translation import ugettext_lazy as _ +from datetime import datetime, date DEBUG = True if os.environ.get('DEBUG', 'True') else False @@ -206,3 +207,8 @@ JQUERY_UI_FILENAME = 'jquery-ui-1.9.2.min.js' #SHOP_CURRENCY_LOCALE = '' SHOP_USE_VARIATIONS = True SHOP_USE_RATINGS = False + + +date_now = datetime.now() +CURRENT_SEASON = int(date_now.year) - 1 if datetime(date_now.year, 1,1) <= date_now and date_now <= datetime(date_now.year, 7, 31) else date_now.year +CURRENT_SEASON_STYLED = str(CURRENT_SEASON)[-2:]+"."+str(CURRENT_SEASON+1)[-2:] diff --git a/app/organization/core/context_processors.py b/app/organization/core/context_processors.py new file mode 100644 index 00000000..38e415d1 --- /dev/null +++ b/app/organization/core/context_processors.py @@ -0,0 +1,7 @@ +from django.conf import settings # import the settings file + + +def static(request): + + return {'CURRENT_SEASON': settings.CURRENT_SEASON, + 'CURRENT_SEASON_STYLED': settings.CURRENT_SEASON_STYLED} diff --git a/app/settings.py b/app/settings.py index b3402f5b..9ca49374 100644 --- a/app/settings.py +++ b/app/settings.py @@ -271,7 +271,8 @@ TEMPLATES = [{'APP_DIRS': True, 'django.core.context_processors.request', 'django.core.context_processors.tz', 'mezzanine.conf.context_processors.settings', - 'mezzanine.pages.context_processors.page')}}] + 'mezzanine.pages.context_processors.page', + 'organization.core.context_processors.static')}}] # List of middleware classes to use. Order is important; in the request phase, # these middleware classes will be applied in the order given, and in the @@ -343,6 +344,8 @@ except ImportError as e: raise e + + #################### # DYNAMIC S ETTINGS # #################### diff --git a/app/templates/agenda/event_list.html b/app/templates/agenda/event_list.html index 1142f0ec..8f9ca26f 100644 --- a/app/templates/agenda/event_list.html +++ b/app/templates/agenda/event_list.html @@ -74,7 +74,11 @@ {% if tag and tag|tag_is_excluded %} {% trans "Tournées" %} {% else %} - {% trans "Rendez-vous" %} + {% if is_archive %} + {% trans "Archives" %} + {% else %} + {% trans "Events" %} + {% endif %} {% endif %} {% endif %} @@ -88,14 +92,13 @@
- - {% if tag and not tag|tag_is_excluded or not tag %} + {% if tag and not tag|tag_is_excluded or not tag and not is_archive %} - - {% pagination_for events %} - + {% if not is_archive %} +
{% trans 'archive' %}
+ {% endif %}
{% endblock %} diff --git a/app/templates/home/inc/services.html b/app/templates/home/inc/services.html index 558e57e4..edd88491 100644 --- a/app/templates/home/inc/services.html +++ b/app/templates/home/inc/services.html @@ -11,7 +11,7 @@