Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
steering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
steering
Commits
35bf6baf
Commit
35bf6baf
authored
9 years ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
replaced permalink calls, cleaned-up Show model
parent
6fb0d0a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
program/models.py
+9
-11
9 additions, 11 deletions
program/models.py
with
9 additions
and
11 deletions
program/models.py
+
9
−
11
View file @
35bf6baf
from
django.contrib.auth.models
import
User
from
django.core.exceptions
import
ObjectDoesNotExist
,
ValidationError
,
MultipleObjectsReturned
from
django.core.urlresolvers
import
reverse
from
django.db
import
models
from
django.db.models
import
Q
from
django.utils.translation
import
ugettext_lazy
as
_
...
...
@@ -221,19 +222,18 @@ class Host(models.Model):
def
__unicode__
(
self
):
return
u
'
%s
'
%
self
.
name
@models.permalink
def
get_absolute_url
(
self
):
return
(
'
host-detail
'
,
[
str
(
self
.
id
)
])
return
reverse
(
'
host-detail
'
,
args
=
[
self
.
id
])
class
Show
(
models
.
Model
):
predecessor
=
models
.
ForeignKey
(
'
self
'
,
blank
=
True
,
null
=
True
,
related_name
=
'
successors
'
,
verbose_name
=
_
(
"
Predecessor
"
))
hosts
=
models
.
ManyToManyField
(
Host
,
blank
=
True
,
null
=
True
,
related_name
=
'
shows
'
,
verbose_name
=
_
(
"
Hosts
"
))
owners
=
models
.
ManyToManyField
(
User
,
blank
=
True
,
null
=
True
,
related_name
=
'
shows
'
,
verbose_name
=
_
(
"
Owners
"
))
hosts
=
models
.
ManyToManyField
(
Host
,
related_name
=
'
shows
'
,
verbose_name
=
_
(
"
Hosts
"
))
owners
=
models
.
ManyToManyField
(
User
,
related_name
=
'
shows
'
,
verbose_name
=
_
(
"
Owners
"
))
broadcastformat
=
models
.
ForeignKey
(
BroadcastFormat
,
related_name
=
'
shows
'
,
verbose_name
=
_
(
"
Broadcast format
"
))
showinformation
=
models
.
ManyToManyField
(
ShowInformation
,
blank
=
True
,
null
=
True
,
related_name
=
'
shows
'
,
verbose_name
=
_
(
"
Show information
"
))
showtopic
=
models
.
ManyToManyField
(
ShowTopic
,
blank
=
True
,
null
=
True
,
related_name
=
'
shows
'
,
verbose_name
=
_
(
"
Show topic
"
))
musicfocus
=
models
.
ManyToManyField
(
MusicFocus
,
blank
=
True
,
null
=
True
,
related_name
=
'
shows
'
,
verbose_name
=
_
(
"
Music focus
"
))
showinformation
=
models
.
ManyToManyField
(
ShowInformation
,
related_name
=
'
shows
'
,
verbose_name
=
_
(
"
Show information
"
))
showtopic
=
models
.
ManyToManyField
(
ShowTopic
,
related_name
=
'
shows
'
,
verbose_name
=
_
(
"
Show topic
"
))
musicfocus
=
models
.
ManyToManyField
(
MusicFocus
,
related_name
=
'
shows
'
,
verbose_name
=
_
(
"
Music focus
"
))
name
=
models
.
CharField
(
_
(
"
Name
"
),
max_length
=
255
)
slug
=
models
.
CharField
(
_
(
"
Slug
"
),
max_length
=
255
,
unique
=
True
)
image
=
models
.
ImageField
(
_
(
"
Image
"
),
blank
=
True
,
null
=
True
,
upload_to
=
'
show_images
'
)
...
...
@@ -255,9 +255,8 @@ class Show(models.Model):
def
__unicode__
(
self
):
return
u
'
%s
'
%
self
.
name
@models.permalink
def
get_absolute_url
(
self
):
return
(
'
show-detail
'
,
[
self
.
slug
])
return
reverse
(
'
show-detail
'
,
args
=
[
self
.
slug
])
def
has_active_programslots
(
self
):
return
self
.
programslots
.
filter
(
until__gt
=
date
.
today
()).
count
()
>
0
...
...
@@ -475,9 +474,8 @@ class TimeSlot(models.Model):
self
.
show
=
self
.
programslot
.
show
super
(
TimeSlot
,
self
).
save
(
*
args
,
**
kwargs
)
@models.permalink
def
get_absolute_url
(
self
):
return
(
'
timeslot-detail
'
,
[
self
.
id
])
return
reverse
(
'
timeslot-detail
'
,
args
=
[
self
.
id
])
class
Note
(
models
.
Model
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment