Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Simon Daron
panikweb
Commits
51d8722f
Commit
51d8722f
authored
Oct 31, 2013
by
fred
Browse files
simplify newsroll
parent
3317d11a
Changes
4
Hide whitespace changes
Inline
Side-by-side
panikweb/paniktags/templatetags/paniktags.py
View file @
51d8722f
...
...
@@ -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
]
}
...
...
panikweb/views.py
View file @
51d8722f
...
...
@@ -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
]
...
...
panikweb_templates/templates/home.html
View file @
51d8722f
...
...
@@ -27,9 +27,7 @@
<div
class=
"rightPart"
>
<h1
class=
"top"
>
Focus
</h1>
{% with focus as news %}
{% newsroll %}
{% endwith %}
{% newsroll %}
{% if newsitems %}
...
...
panikweb_templates/templates/news/roll.html
View file @
51d8722f
...
...
@@ -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' }}"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment