Commit 51d8722f authored by fred's avatar fred

simplify newsroll

parent 3317d11a
......@@ -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]
}
......
......@@ -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]
......
......@@ -27,9 +27,7 @@
<div class="rightPart">
<h1 class="top">Focus</h1>
{% with focus as news %}
{% newsroll %}
{% endwith %}
{% newsroll %}
{% if newsitems %}
......
......@@ -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' }}" />
......
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