]> git.parisson.com Git - mezzo.git/commitdiff
Fix product first fields when multiple languages
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 6 Oct 2016 09:59:46 +0000 (11:59 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 6 Oct 2016 09:59:46 +0000 (11:59 +0200)
app/organization/core/admin.py
app/settings.py
app/templates/agenda/includes/event_date.html
app/templates/agenda/includes/event_metainfo_line.html
app/templates/shop/includes/product_list_circle_style.html [new file with mode: 0644]

index abdeaffa073744ec6ad6dff6aa1d1633fdb9f438..631dff66cda51ec26677d20e857801d1e9a3c0bb 100644 (file)
@@ -5,6 +5,7 @@ from mezzanine.pages.admin import PageAdmin
 from organization.core.models import *
 from mezzanine.blog.models import BlogPost
 from mezzanine.generic.models import ThreadedComment, Keyword
+from mezzanine.conf import settings
 
 
 class KeywordAdmin(BaseTranslationModelAdmin):
@@ -16,7 +17,14 @@ class BaseTranslationOrderedModelAdmin(BaseTranslationModelAdmin):
 
     def get_fieldsets(self, request, obj = None):
         res = super(BaseTranslationOrderedModelAdmin, self).get_fieldsets(request, obj)
-        for field in reversed(self.first_fields):
+        fields = reversed(self.first_fields)
+        if settings.USE_MODELTRANSLATION:
+            lang = settings.LANGUAGE_CODE
+            lang_fields = []
+            for field in fields:
+                lang_fields.append(field + '_' + lang)
+            fields = lang_fields
+        for field in fields:
             for trans_field in res[0][1]['fields']:
                 if field in trans_field:
                     index = res[0][1]['fields'].index(trans_field)
index bd1ffe2d40f727ab8bab030559547d1ce062f97f..b3402f5bd1d2af438415a45c1874186661e32725 100644 (file)
@@ -257,11 +257,6 @@ MIGRATION_MODULES = {
     "generic": "migrations.generic",
 }
 
-MODELTRANSLATION_TRANSLATION_FILES = (
-    'organization.core.translation',
-    'organization.festival.translation',
-    'organization.magazine.translation'
-)
 
 TEMPLATES = [{'APP_DIRS': True,
                'BACKEND': 'django.template.backends.django.DjangoTemplates',
index 6c09e33176bcc5bedfb4d418d3bf8715ede8c191..f740cbfaeda80771fcfadce90644299dd519a188 100644 (file)
@@ -17,7 +17,7 @@
             {{ event.start|date:"l j F" }}
             <!-- Start date with hour  -->
             {% if event.start|date:"H:i" != "00:00" %}
-                {% trans "from" %}
+                {% trans "at" %}
                 {{ event.start|date:"H\hi" }}
                 {% comment %}
                     {% if event.end|date:"H:i" != "00:00" %}
@@ -38,7 +38,7 @@
         {% for period in event.periods.all %}
             {% trans "From" %} {{ period.date_from|date:"j H:i" }} {% trans "to" %} {{ period.date_to|date:"j F H:i" }}
         {% endfor %}
-        
+
     <!-- Start and end date are completely different  -->
     {% else %}
 
index 326e680b43fc9ba59a623414b1a5cd4a1c65cdd5..ae27e3e55248e95224353d9a579cc2aa2522f5d8 100644 (file)
@@ -1,7 +1,9 @@
 {% load i18n mezzanine_tags event_tags  %}
 
 <div class="page__meta-date">
-    {% include 'agenda/includes/event_date.html' %}
+    <a href="{{ event.get_absolute_url }}">
+        {% include 'agenda/includes/event_date.html' %}
+    </a>
 </div>
 
 <div class="page__meta-separator"></div>
diff --git a/app/templates/shop/includes/product_list_circle_style.html b/app/templates/shop/includes/product_list_circle_style.html
new file mode 100644 (file)
index 0000000..d0e75d6
--- /dev/null
@@ -0,0 +1,46 @@
+{% load organization_tags mezzanine_tags %}
+{% if list %}
+    <div class="white-bg pb2">
+        <hr class="mt0" />
+        <div class="container">
+            <div class="row">
+                <div class="col-sm-9 col-sm-push-3 col-lg-8 col-lg-push-2" data-summary-content>
+                    <h2 class="dotted">{{ list.title }}</h2>
+                    {% if list.description %}
+                        <p>{{ list.description }}</p>
+                    {% endif %}
+                </div>
+            </div>
+        </div>
+
+        <div class="container-fluid">
+            <div class="row tac">
+                {% for product_inline in list.products.all %}
+                  {% with product_inline.product as product %}
+                    <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">
+                        <div class="article-box article-box--person" >
+                            {% if product.images.all %}
+                                <div class="article-box__header">
+                                    <a href="{{ product.get_absolute_url }}" title="{{ product.title }}">
+                                        <figure class="article-box__image">
+                                            <img class="lazyload" src="{{ MEDIA_URL }}{% thumbnail product.images.all.0 427 500 top=0.5 %}" alt="product"/>
+                                        </figure>
+                                    </a>
+                                </div>
+                            {% endif %}
+                            <div class="article-box__content tal">
+                                <a href="{{ product.get_absolute_url }}" title="{{ product.title }}"><h3 class="article-box__title">{{ product.title }}</h3></a>
+                                {% if product.description %}
+                                    <div class="article-box__desc">{{ product.description|richtext_filters|safe|truncatechars_html:255 }}</div>
+                                {% elif product.content %}
+                                    <div class="article-box__desc">{{ product.content|richtext_filters|safe|truncatechars_html:255 }}</div>
+                                {% endif %}
+                            </div>
+                        </div>
+                    </div>
+                  {% endwith %}
+                {% endfor %}
+            </div>
+        </div>
+    </div>
+{% endif %}