]> git.0d.be Git - panikweb.git/commitdiff
add photos page to home
authorFrédéric Péters <fpeters@0d.be>
Tue, 1 Aug 2017 20:12:08 +0000 (22:12 +0200)
committerFrédéric Péters <fpeters@0d.be>
Tue, 1 Aug 2017 20:12:08 +0000 (22:12 +0200)
panikweb/views.py
panikweb_templates/templates/home.html

index 9ba364d5ac89b78af9f13867312aa1644b3a8f20..0888cd2ed71985895be150d8a1d7e654a413a394 100644 (file)
@@ -36,6 +36,7 @@ from newsletter.forms import SubscribeForm
 from nonstop.utils import get_current_nonstop_track
 from nonstop.models import SomaLogLine
 
+from combo.data.models import Page
 from panikombo.models import ItemTopik
 
 from . import utils
@@ -529,6 +530,10 @@ class Home(TemplateView):
                     tables=['emissions_diffusion'],).order_by('-creation_timestamp').distinct() [:3]
 
         context['newsletter_form'] = SubscribeForm()
+        try:
+            context['photos_page'] = Page.objects.get(slug='photos')
+        except Page.DoesNotExist:
+            pass
 
         return context
 
index 5149f1a9267423361b68655606210fbc7067bd2c..4a0e024b3f77faa07a87b2408f1cee11249d600b 100644 (file)
            </div>
            </a>
            {% endfor %}
+           {% if photos_page %}
+           <a href="{{photos_page.get_online_url}}">
+           <div class="emission-tile">
+                   <div class="image">
+                       {% thumbnail photos_page.picture "400x400" crop="50% 50%" as im %}
+                       <img src="{{im.url}}">
+                       {% endthumbnail %}
+                   </div>
+                   <div class="name"><span>{{photos_page.title}}</span></div>
+           </div>
+           </a>
+           {% endif %}
            {% endspaceless %}