Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
radiopanik
panikdb
Commits
55d8ef33
Commit
55d8ef33
authored
Oct 21, 2013
by
fred
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add context support for soundfiles
parent
869e7e35
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
panikdb/aa/models.py
panikdb/aa/models.py
+3
-1
panikdb/customtags/templatetags/panikdbtags.py
panikdb/customtags/templatetags/panikdbtags.py
+4
-0
No files found.
panikdb/aa/models.py
View file @
55d8ef33
...
...
@@ -4,7 +4,7 @@ from django.contrib.auth.models import AbstractUser
from
django.core
import
validators
from
django.db
import
models
from
emissions.models
import
Emission
,
Episode
,
NewsItem
,
NewsCategory
from
emissions.models
import
Emission
,
Episode
,
NewsItem
,
NewsCategory
,
SoundFile
class
User
(
AbstractUser
):
emissions
=
models
.
ManyToManyField
(
Emission
,
null
=
True
,
blank
=
True
)
...
...
@@ -17,6 +17,8 @@ class User(AbstractUser):
return
object
in
self
.
emissions
.
all
()
if
isinstance
(
object
,
Episode
):
return
object
.
emission
in
self
.
emissions
.
all
()
if
isinstance
(
object
,
SoundFile
):
return
object
.
episode
.
emission
in
self
.
emissions
.
all
()
if
isinstance
(
object
,
NewsItem
):
return
object
.
emission
in
self
.
emissions
.
all
()
return
False
panikdb/customtags/templatetags/panikdbtags.py
View file @
55d8ef33
...
...
@@ -23,6 +23,8 @@ def context_url(object):
return
reverse
(
'emission-view'
,
kwargs
=
{
'slug'
:
object
.
emission
.
slug
})
if
isinstance
(
object
,
Episode
):
return
reverse
(
'emission-view'
,
kwargs
=
{
'slug'
:
object
.
emission
.
slug
})
if
isinstance
(
object
,
SoundFile
):
return
reverse
(
'emission-view'
,
kwargs
=
{
'slug'
:
object
.
episode
.
emission
.
slug
})
return
None
...
...
@@ -32,6 +34,8 @@ def context_title(object):
return
object
.
emission
.
title
if
isinstance
(
object
,
Episode
):
return
object
.
emission
.
title
if
isinstance
(
object
,
SoundFile
):
return
object
.
episode
.
emission
.
title
return
None
...
...
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