Commit 2f63bfab authored by fred's avatar fred

slice the right number of soundfiles in views

parent d447ba33
......@@ -14,23 +14,17 @@
{% 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 %}
......@@ -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 %}
......
......@@ -17,12 +17,12 @@
<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>
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment