Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
radiopanik
panikdb
Commits
aecdfc32
Commit
aecdfc32
authored
Aug 22, 2013
by
fred
Browse files
add main_sound property, to get the main sound of an episode (#1079)
parent
63f6a2c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
panikdb/emissions/models.py
View file @
aecdfc32
...
...
@@ -181,6 +181,12 @@ class Episode(models.Model):
def
has_sound
(
self
):
return
(
self
.
soundfile_set
.
count
()
>
0
)
def
main_sound
(
self
,
podcastable
=
True
):
t
=
self
.
soundfile_set
.
exclude
(
podcastable
=
False
).
exclude
(
fragment
=
True
)
if
t
:
return
t
[
0
]
return
None
class
Diffusion
(
models
.
Model
):
episode
=
models
.
ForeignKey
(
'Episode'
,
verbose_name
=
u
'Episode'
)
...
...
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