]> git.parisson.com Git - mezzo.git/commitdiff
Fix image inlines as list
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 27 Sep 2016 14:03:59 +0000 (16:03 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 27 Sep 2016 14:03:59 +0000 (16:03 +0200)
app/organization/agenda/models.py
app/organization/core/templatetags/organization_tags.py
app/templates/core/inc/generic_card.html
app/templates/index.html

index d62f1bddee5d85639138cbe6ae937f078b9021ee..c7a35b0e4cc9baa0872e2b7df93c5eec3a429169 100644 (file)
@@ -24,6 +24,7 @@ class EventImage(Image):
     class Meta:
         verbose_name = _("image")
         verbose_name_plural = _("images")
+        order_with_respect_to = "event"
 
 
 class EventDepartment(models.Model):
index 693d9c80d39d5436c67a72b6a8d0e9757ab1dda8..e89fd63ce1f6ea707a4b60928414aa9d33b578b4 100644 (file)
@@ -93,7 +93,13 @@ def get_mezzanine_menu_name(menu_id):
 
 @register.filter
 def get_type(objects, type):
-    objs = objects.filter(type=type)
+    if isinstance(objects, list):
+        objs = []
+        for object in objects:
+            if obj.type == type:
+                objs.append(obj)
+    else:
+        objs = objects.filter(type=type)
     if objs:
         return objs
     return None
index 790a9780a74e471dc305d5ddbf7a77438454af77..a9f6c2dc796443d5a86dc7ec49d7b2a1eef94378 100644 (file)
@@ -3,9 +3,9 @@
 <a class="article-box" href="{{ content.content_object.get_absolute_url }}" title="{{ content.content_object.title }}">
     <div class="article-box__header">
         <figure class="article-box__image">
-            {% with content.content_object.images.all|get_type:'card' as image %}
-                {% if image %}
-                    <img src="{{ MEDIA_URL }}{% thumbnail image.first.file 427 286 %}" data-src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 %}" class="lazyload" alt="" />
+            {% with content.content_object.images.all|get_type:'card' as images %}
+                {% if images %}
+                    <img src="{{ MEDIA_URL }}{% thumbnail images.first.file 427 286 %}" data-src="{{ MEDIA_URL }}{% thumbnail images.0.file 427 286 %}" class="lazyload" alt="" />
                 {% endif %}
             {% endwith %}
         </figure>
index f828116fd189f418fd4fa630c53225436223022c..8dfe85ce8607abae9b339e635027a3ea59d0abf5 100644 (file)
@@ -1,5 +1,5 @@
 {% extends "base.html" %}
-{% load i18n  pages_tags mezzanine_tags %}
+{% load i18n pages_tags mezzanine_tags %}
 
 {% block meta_title %}
     {% trans "Home" %}