From: Guillaume Pellerin Date: Tue, 27 Sep 2016 14:03:59 +0000 (+0200) Subject: Fix image inlines as list X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=2416278bfa3c1754f425a9bdb8712261e8e1fabc;p=mezzo.git Fix image inlines as list --- diff --git a/app/organization/agenda/models.py b/app/organization/agenda/models.py index d62f1bdd..c7a35b0e 100644 --- a/app/organization/agenda/models.py +++ b/app/organization/agenda/models.py @@ -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): diff --git a/app/organization/core/templatetags/organization_tags.py b/app/organization/core/templatetags/organization_tags.py index 693d9c80..e89fd63c 100644 --- a/app/organization/core/templatetags/organization_tags.py +++ b/app/organization/core/templatetags/organization_tags.py @@ -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 diff --git a/app/templates/core/inc/generic_card.html b/app/templates/core/inc/generic_card.html index 790a9780..a9f6c2dc 100644 --- a/app/templates/core/inc/generic_card.html +++ b/app/templates/core/inc/generic_card.html @@ -3,9 +3,9 @@
- {% with content.content_object.images.all|get_type:'card' as image %} - {% if image %} - + {% with content.content_object.images.all|get_type:'card' as images %} + {% if images %} + {% endif %} {% endwith %}
diff --git a/app/templates/index.html b/app/templates/index.html index f828116f..8dfe85ce 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load i18n pages_tags mezzanine_tags %} +{% load i18n pages_tags mezzanine_tags %} {% block meta_title %} {% trans "Home" %}