]> git.0d.be Git - panikweb.git/commitdiff
slice the right number of soundfiles in views
authorFrédéric Péters <fpeters@0d.be>
Sun, 22 Nov 2020 14:04:38 +0000 (15:04 +0100)
committerFrédéric Péters <fpeters@0d.be>
Sun, 22 Nov 2020 14:04:38 +0000 (15:04 +0100)
panikweb/templates/combo/soundscell.html
panikweb/templates/home.html
panikweb/templates/listen.html
panikweb/views.py

index 0044b1d3da3df1c1256e8e7a5ae72b13305d85a2..4d75f5a59ec08139082c4d21166bd81b217c4e4c 100644 (file)
   {% endif %}
 
   <ul class="custom list">
-    {% with count_s=count|stringformat:"s" %}
-    {% with slice_count=":"|add:count_s %}
-    {% for soundfile in soundfiles|slice:slice_count %}
+    {% for soundfile in soundfiles %}
       <li class="item">
         {% soundfile_resume soundfile=soundfile date=soundfile.first_diffusion %}
       </li>
     {% endfor %}
-    {% endwith %}
-    {% endwith %}
   </ul>
 {% else %}
   <h3 class="sectionLabel">{% firstof title cell.title %}</h3>
 
   <ul class="custom padded main-flex">
-  {% with count_s=count|stringformat:"s" %}
-  {% with slice_count=":"|add:count_s %}
-  {% for soundfile in soundfiles|slice:slice_count %}
+  {% for soundfile in soundfiles %}
     <li class="soundfile frontpage">
       <div class="content content-inline cf special">
         <a class="block cf" href="{% url 'episode-view' emission_slug=soundfile.episode.emission.slug slug=soundfile.episode.slug %}">
@@ -68,8 +62,6 @@
       </div>
     </li>
   {% endfor %}
-  {% endwith %}
-  {% endwith %}
   </ul>
 
 {% endif %}
index dd87a1533367b823e74ced9ea4b9b72c7d76c925..19ccb0f2bd021b0b3a6ced96517a5c2e907d3775 100644 (file)
@@ -62,7 +62,7 @@
             {% if soundfiles %}
 
                    <div id="recent-sounds">
-                    {% include "combo/soundscell.html" with include_search_input=False count=3 sidebar=True %}
+                    {% include "combo/soundscell.html" with include_search_input=False sidebar=True %}
                    </div>
                    {% endif %}
 
index fa22fcffa1e27c47a070eb8391f054d6b7974065..80ac94b9c19f4d4bdde792c1ad6adc30bfe7c09d 100644 (file)
 
     <div class="leftPart">
       <div class="soundfiles focus-title">
-        {% include "combo/soundscell.html" with include_search_input=True count=10 title="Focus" soundfiles=focus %}
+        {% include "combo/soundscell.html" with include_search_input=True title="Focus" soundfiles=focus %}
       </div>
     </div>
     <div class="rightPart">
       <div class="sub">
-        {% include "combo/soundscell.html" with include_search_input=True count=20 sidebar=True %}
+        {% include "combo/soundscell.html" with include_search_input=True sidebar=True %}
       </div>
     </div>
   </div>
index 37049b8ddf5242c17ce3efc46683954f0936536b..1ab50f014065351f6ce2c29edfeb9b1df08e6bf5 100644 (file)
@@ -642,7 +642,7 @@ class Listen(TemplateView):
                     where=['''datetime = (SELECT MIN(datetime)
                                             FROM emissions_diffusion
                                         WHERE episode_id = emissions_episode.id)'''],
-                    tables=['emissions_diffusion'],).order_by('-creation_timestamp').distinct()
+                    tables=['emissions_diffusion'],).order_by('-creation_timestamp').distinct()[:20]
 
 
         return context