From 438c7b5ae1bf4147298171f24a647fe77fd0c636 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 27 Jul 2018 20:43:28 +0100 Subject: [PATCH] Add images to pages --- docker-compose.yml | 1 + templates/common/content.html | 8 +++-- templates/pages/section_index_page.html | 41 ++++++++++++++----------- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0740ac0..2f91bfe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,6 +31,7 @@ services: - ./project/:/app/project/ - ./static/:/app/static/ - ./templates/:/app/templates/ + - ./docker-data/media:/app/media depends_on: - db diff --git a/templates/common/content.html b/templates/common/content.html index 4a6680b..2ba5eba 100644 --- a/templates/common/content.html +++ b/templates/common/content.html @@ -1,6 +1,10 @@ -{% load wagtailcore_tags %} +{% load wagtailcore_tags wagtailimages_tags %} -
+ +{% if page.image %} + {% image page.image width-1000 as photo %} +
+{% endif %}

{{ page.title }}

Subtitle

{% include "common/content_details.html" with page=page %}

diff --git a/templates/pages/section_index_page.html b/templates/pages/section_index_page.html index d349f47..73810af 100644 --- a/templates/pages/section_index_page.html +++ b/templates/pages/section_index_page.html @@ -1,30 +1,35 @@ {% extends "base.html" %} -{% load static %} +{% load static wagtailimages_tags %} {% block content %}
- {% include "common/content.html" %} + {% include "common/content.html" %} -
+ {% if page.body %} +
+ {% endif %} - {% for child in page.get_children.specific %} -
-
- -
-
+ {% for child in page.get_children.specific %} +
+
+ {% if child.image %} + + {% image child.image width-300 as photo %} +
+
+ {% endif %} +
+
+ +
{{ child.title }}
+
+ {% include "common/content_details.html" with page=child %} +

{{ child.get_short_body }}

+
-
- -
{{ child.title }}
-
- {% include "common/content_details.html" with page=child %} -

{{ child.get_short_body }}

-
-
- {% endfor %} + {% endfor %}
{% endblock %}