]> git.parisson.com Git - mezzo.git/commitdiff
Event : add archives
authorEmilie <zawadzki@ircam.fr>
Thu, 20 Oct 2016 15:08:39 +0000 (17:08 +0200)
committerEmilie <zawadzki@ircam.fr>
Thu, 20 Oct 2016 15:08:39 +0000 (17:08 +0200)
app/local_settings.py
app/organization/core/context_processors.py [new file with mode: 0644]
app/settings.py
app/templates/agenda/event_list.html
app/templates/home/inc/services.html

index 466df4458f26b450d4d7fa0c2c4d9b9fd768c66b..6eb1db2cb24a954d5435c0d1c8b8f80824015b1c 100644 (file)
@@ -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 (file)
index 0000000..38e415d
--- /dev/null
@@ -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}
index b3402f5bd1d2af438415a45c1874186661e32725..9ca49374e218ee1e1ef66444cde365bf30711b2e 100644 (file)
@@ -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 #
 ####################
index 1142f0eca2b09eb177ec482e4248db0161781de1..8f9ca26f9ef8e91c28d81fe960afc9649287c9fb 100644 (file)
                             {% 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 %}
                     </h1>
                 <div class="col-sm-3 col-lg-2 page__sidebar">
 
                     <div style="position: relative;" >
-
-                        {% 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 %}
                         <a class="banner banner--light banner--sidebar" href="{% url 'event_list_tag' 'tournees' %}" style="background-image:url({% static 'img/services/tours.jpg' %});">
 
                             <div class="banner__content">
 
                                 <div class="banner__title fsxxxl">
-                                    Tournées 16.17
+                                    Tournées {{ CURRENT_SEASON_STYLED }}
                                 </div>
                                 <div class="banner__desc fss">
                                     Campo Santo, Songes et Métamorphoses, Providences, UM souverain moteur de toutes choses...
 
                         <ul class="nav-tree nav-tree--level-{{ branch_level }}" data-sticky data-sticky-parent="row" data-sticky-offset="100" data-sticky-detach-at="971">
                             <li class="nav-tree__item">
-                                <a class="nav-tree__link active" href="{{ page.get_absolute_url }}">
+                                <a class="nav-tree__link active" href="{% url 'event_list' %}">
                                     {% if tag and tag|tag_is_excluded %}
                                         {% trans "Tournées" %}
                                     {% else %}
 
                             </li>
 
-                            {% 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 %}
 
                                 {% keywords_for mezzanine_agenda.event as tags %}
                                 {# {% all_events as all_events %}#}
             </div>
 
         </div>
-
-        {% pagination_for events %}
-
+        {% if not is_archive %}
+            <div><a href="{% url "event_list_year" CURRENT_SEASON %}" title="{% trans 'archive' %}">{% trans 'archive' %}</div>
+        {% endif %}
     </div>
 {% endblock %}
index 558e57e4ce4ad07a21eac0bafcb4174ce5b68770..edd884913500954ff8105b4afa3c4a4cde0edc8f 100644 (file)
@@ -11,7 +11,7 @@
                 <div class="banner__content">
 
                     <div class="banner__title fsxxxl">
-                        Tournées 16.17
+                        Tournées {{ CURRENT_SEASON_STYLED }}
                     </div>
                     <div class="banner__desc fss">
                         Campo Santo, Songes et Métamorphoses, Providences, UM souverain moteur de toutes choses...