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
radiopanik
panikweb
Commits
12795fdf
Commit
12795fdf
authored
Aug 27, 2013
by
Simon Daron
Browse files
Add podcast to Listen & correct episode urls
parent
d2a7f65c
Changes
6
Hide whitespace changes
Inline
Side-by-side
panikweb/paniktags/templatetags/paniktags.py
View file @
12795fdf
...
...
@@ -19,6 +19,7 @@ def audio(sound=None):
@
register
.
inclusion_tag
(
'episodes/resume.html'
,
takes_context
=
True
)
def
episode_resume
(
context
,
date
=
None
):
return
{
'emission'
:
context
.
get
(
'emission'
),
'episode'
:
context
.
get
(
'episode'
),
'date'
:
date
,
}
...
...
@@ -26,6 +27,7 @@ def episode_resume(context, date=None):
@
register
.
inclusion_tag
(
'episodes/inline.html'
,
takes_context
=
True
)
def
episode_inline
(
context
,
date
=
None
):
return
{
'emission'
:
context
.
get
(
'emission'
),
'episode'
:
context
.
get
(
'episode'
),
'date'
:
date
,
}
...
...
panikweb/views.py
View file @
12795fdf
...
...
@@ -292,6 +292,26 @@ class Listen(TemplateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
Listen
,
self
).
get_context_data
(
**
kwargs
)
context
[
'sounds'
]
=
SoundFile
.
objects
.
all
()[:
15
]
listenable
=
[]
x
=
0
for
episode
in
Episode
.
objects
.
all
().
extra
(
select
=
{
'first_diffusion'
:
'emissions_diffusion.datetime'
,
},
select_params
=
(
False
,
True
),
where
=
[
'''datetime = (SELECT MIN(datetime)
FROM emissions_diffusion
WHERE episode_id = emissions_episode.id)'''
],
tables
=
[
'emissions_diffusion'
],
).
order_by
(
'-first_diffusion'
).
reverse
():
if
x
>=
24
:
break
elif
episode
.
has_sound
is
None
:
continue
else
:
x
+=
1
listenable
.
append
(
episode
)
context
[
'episodes'
]
=
listenable
return
context
listen
=
Listen
.
as_view
()
...
...
panikweb_templates/templates/emissions/emission_detail.html
View file @
12795fdf
...
...
@@ -47,7 +47,7 @@
</ul>
{% endfor %}
</div>
{% endif %}
{% endif %}
</div>
</div>
{% endblock %}
...
...
panikweb_templates/templates/episodes/inline.html
View file @
12795fdf
...
...
@@ -23,7 +23,7 @@
</div>
{% endif %}
<div
class=
"content"
>
<a
class=
"block"
href=
"{
{ episode.slug }
}"
>
<a
class=
"block"
href=
"{
% url 'episode-view' emission_slug=episode.emission.slug slug=episode.slug %
}"
>
<h5
class=
"title ellipsis"
>
{{ episode.title }}
</h5>
{% if episode.description %}
<div
class=
"description ellipsis"
>
...
...
panikweb_templates/templates/episodes/resume.html
View file @
12795fdf
...
...
@@ -30,7 +30,7 @@
</div>
{% endif %}
<div
class=
"content"
>
<h5
class=
"title"
><a
href=
"{
{ episode.slug }
}"
>
{{ episode.title }}
</a></h5>
<h5
class=
"title"
><a
href=
"{
% url 'episode-view' emission_slug=episode.emission.slug slug=episode.slug %
}"
>
{{ episode.title }}
</a></h5>
{% if episode.description %}
<article
class=
"text"
>
...
...
panikweb_templates/templates/listen.html
View file @
12795fdf
{% extends "base.html" %}
{% load paniktags %}
{% block bodyID %}Player{% endblock %}
{% block main %}
<div
class=
"wrapper padded"
>
<ul
class=
"small custom list columns"
>
{% for sound in sounds %}
<li
class=
"item ellipsis"
>
{% include "includes/audio.html" with src=sound.file %}
{{ sound.episode }}
<ul
class=
"custom"
>
{% for episode in episodes %}
<li
class=
"item"
>
{% episode_inline %}
</li>
{% endfor %}
</ul>
...
...
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