]> git.0d.be Git - panikweb.git/commitdiff
simplify newsroll
authorFrédéric Péters <fpeters@0d.be>
Thu, 31 Oct 2013 17:57:49 +0000 (18:57 +0100)
committerFrédéric Péters <fpeters@0d.be>
Thu, 31 Oct 2013 18:59:57 +0000 (19:59 +0100)
panikweb/paniktags/templatetags/paniktags.py
panikweb/views.py
panikweb_templates/templates/home.html
panikweb_templates/templates/news/roll.html

index 8e786eabf48feb8e2179b4dc44e7d46b1026a935..ee673f476db0af24a88dee270f0adf762cdc5d13 100644 (file)
@@ -13,7 +13,7 @@ from django.db.models.query import QuerySet
 from django.utils import simplejson
 from datetime import datetime, timedelta
 
-from emissions.models import Emission, Episode, NewsItem, SoundFile
+from emissions.models import Emission, Episode, NewsItem, SoundFile, Focus
 from emissions.utils import period_program
 
 from panikweb import utils
@@ -187,13 +187,11 @@ def news_inline(context, klass=None, logo=None):
             'logo': logo
     }
 
-@register.inclusion_tag('news/roll.html', takes_context=True)
-def newsroll(context, nbr=None):
+@register.inclusion_tag('news/roll.html')
+def newsroll():
     return {
-        'categories': context.get('categories'),
-        'news': context.get('news'),
-        'focus': context.get('focus'),
-        'nbr': nbr,
+        'news': Focus.objects.filter(current=True).select_related('emission', 'newsitem',
+            'soundfile', 'episode', 'newsitem__category').order_by('?')[:3]
     }
 
 
index 53a7ef3712988da9a2e4f988dc442a728fed66d8..f5de3fc96e149c6b2f01265687a96d2997e7739c 100644 (file)
@@ -419,8 +419,6 @@ class Home(TemplateView):
     def get_context_data(self, **kwargs):
         context = super(Home, self).get_context_data(**kwargs)
         context['sectionName'] = "Home"
-        context['focus'] = Focus.objects.filter(current=True).select_related('emission', 'newsitem',
-                'soundfile', 'episode', 'newsitem__category').order_by('?')[:12]
         context['emissions'] = Emission.objects.filter(archived=False).order_by('-creation_timestamp')[:3]
         context['newsitems'] = NewsItem.objects.order_by('-date')[:3]
 
index b752a1bd321cb5aeef7f3ab457f1a3372064c787..aa1f19eda6bf74d9eb794b00a15bebc6328d0784 100644 (file)
@@ -27,9 +27,7 @@
 
            <div class="rightPart">
                    <h1 class="top">Focus</h1>
-               {% with focus as news %}
-                       {% newsroll %}
-               {% endwith %}
+                   {% newsroll %}
 
             {% if newsitems %}
 
index 0285c013b1356852da3d02796d1dd6fa0d6865fa..f40930c3e3d6bc7c58df2d0224d48547bc015e09 100644 (file)
@@ -23,7 +23,7 @@
                </ul>
         <div class="marged">
                    <ul class="custom distributed by3 padded" id="roller">
-                           {% for focus in news|slice:'0:3' %}
+                           {% for focus in news %}
                                    <li style="width:30%;" class="num-{{ forloop.counter }} padded">
                                            <button class="inBlock" data-about="#newsRollId-{{ focus.id }}">
                                                    <img style="width:95%;" src="{{ focus.content_image|thumbnail:'160x120' }}" />