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
1d44cd89
Commit
1d44cd89
authored
9 years ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
moved views
parent
3fa080de
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
program/urls.py
+14
-21
14 additions, 21 deletions
program/urls.py
program/views.py
+29
-2
29 additions, 2 deletions
program/views.py
with
43 additions
and
23 deletions
program/urls.py
+
14
−
21
View file @
1d44cd89
from
django.conf
import
settings
from
django.conf.urls
import
patterns
,
url
from
django.db.models
import
Q
from
django.views.decorators.cache
import
cache_page
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
from
views
import
ShowListView
,
CurrentShowBoxView
,
RecommendationsListView
,
RecommendationsBoxView
,
DayScheduleView
,
StylesView
,
WeekScheduleView
from
models
import
Host
,
Show
,
TimeSlot
import
views
import
os
PROGRAM_SITE_MEDIA
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
../site_media
'
)
hosts
=
Host
.
objects
.
filter
(
Q
(
is_active
=
True
)
|
Q
(
always_visible
=
True
)).
distinct
()
shows
=
Show
.
objects
.
filter
(
is_active
=
True
).
exclude
(
id
=
1
).
distinct
()
timeslots
=
TimeSlot
.
objects
.
all
()
urlpatterns
=
patterns
(
''
,
url
(
r
'
^today/?$
'
,
DayScheduleView
.
as_view
()),
url
(
r
'
^week/?$
'
,
WeekScheduleView
.
as_view
()),
url
(
r
'
^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/?$
'
,
DayScheduleView
.
as_view
()),
url
(
r
'
^(?P<year>\d{4})/(?P<week>\d{1,2})/?$
'
,
WeekScheduleView
.
as_view
()),
url
(
r
'
^current_box/?$
'
,
cache_page
(
60
)(
CurrentShowBoxView
.
as_view
())),
url
(
r
'
^hosts/?$
'
,
ListView
.
as_view
(
context_object_name
=
'
host_list
'
,
queryset
=
hosts
,
template_name
=
'
host_list.html
'
)),
url
(
r
'
^hosts/(?P<pk>\d+)/?$
'
,
DetailView
.
as_view
(
context_object_name
=
'
host
'
,
queryset
=
hosts
,
template_name
=
'
host_detail.html
'
),
name
=
'
host-detail
'
),
url
(
r
'
^tips/?$
'
,
RecommendationsListView
.
as_view
()),
url
(
r
'
^tips_box/?$
'
,
RecommendationsBoxView
.
as_view
()),
url
(
r
'
^shows/?$
'
,
ShowListView
.
as_view
(
context_object_name
=
'
show_list
'
,
queryset
=
shows
,
template_name
=
'
show_list.html
'
)),
url
(
r
'
^shows/(?P<slug>[\w-]+)/?$
'
,
DetailView
.
as_view
(
queryset
=
shows
,
template_name
=
'
show_detail.html
'
),
name
=
'
show-detail
'
),
url
(
r
'
^(?P<pk>\d+)/?$
'
,
DetailView
.
as_view
(
queryset
=
t
ime
s
lot
s
,
template_name
=
'
timeslot_detail.html
'
),
name
=
'
timeslot-detail
'
),
url
(
r
'
^styles.css$
'
,
StylesView
.
as_view
())
url
(
r
'
^today/?$
'
,
views
.
DayScheduleView
.
as_view
()),
url
(
r
'
^week/?$
'
,
views
.
WeekScheduleView
.
as_view
()),
url
(
r
'
^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/?$
'
,
views
.
DayScheduleView
.
as_view
()),
url
(
r
'
^(?P<year>\d{4})/(?P<week>\d{1,2})/?$
'
,
views
.
WeekScheduleView
.
as_view
()),
url
(
r
'
^current_box/?$
'
,
cache_page
(
60
)(
views
.
CurrentShowBoxView
.
as_view
())),
url
(
r
'
^hosts/?$
'
,
views
.
Host
ListView
.
as_view
()),
url
(
r
'
^hosts/(?P<pk>\d+)/?$
'
,
views
.
Host
DetailView
.
as_view
(),
name
=
'
host-detail
'
),
url
(
r
'
^tips/?$
'
,
views
.
RecommendationsListView
.
as_view
()),
url
(
r
'
^tips_box/?$
'
,
views
.
RecommendationsBoxView
.
as_view
()),
url
(
r
'
^shows/?$
'
,
views
.
ShowListView
.
as_view
()),
url
(
r
'
^shows/(?P<slug>[\w-]+)/?$
'
,
views
.
Show
DetailView
.
as_view
(),
name
=
'
show-detail
'
),
url
(
r
'
^(?P<pk>\d+)/?$
'
,
views
.
T
ime
S
lot
DetailView
.
as_view
(
),
name
=
'
timeslot-detail
'
),
url
(
r
'
^styles.css$
'
,
views
.
StylesView
.
as_view
())
)
if
settings
.
DEBUG
:
urlpatterns
+=
patterns
(
''
,
...
...
This diff is collapsed.
Click to expand it.
program/views.py
+
29
−
2
View file @
1d44cd89
...
...
@@ -5,13 +5,31 @@ from django.db.models import Q
from
django.http
import
HttpResponse
from
django.shortcuts
import
get_object_or_404
from
django.views.generic.base
import
TemplateView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
from
models
import
BroadcastFormat
,
MusicFocus
,
Note
,
Show
,
ShowInformation
,
ShowTopic
,
TimeSlot
from
models
import
BroadcastFormat
,
MusicFocus
,
Note
,
Show
,
ShowInformation
,
ShowTopic
,
TimeSlot
,
Host
from
program.utils
import
tofirstdayinisoweek
class
HostListView
(
ListView
):
context_object_name
=
'
host_list
'
queryset
=
Host
.
objects
.
filter
(
Q
(
is_active
=
True
)
|
Q
(
always_visible
=
True
)).
distinct
()
template_name
=
'
host_list.html
'
class
HostDetailView
(
DetailView
):
context_object_name
=
'
host
'
queryset
=
Host
.
objects
.
filter
(
Q
(
is_active
=
True
)
|
Q
(
always_visible
=
True
)).
distinct
()
template_name
=
'
host_detail.html
'
class
ShowListView
(
ListView
):
context_object_name
=
'
show_list
'
queryset
=
Show
.
objects
.
filter
(
is_active
=
True
).
exclude
(
id
=
1
).
distinct
()
template_name
=
'
show_list.html
'
def
get_queryset
(
self
):
queryset
=
Show
.
objects
.
filter
(
programslots__until__gt
=
date
.
today
()).
exclude
(
id
=
1
).
distinct
()
...
...
@@ -31,6 +49,15 @@ class ShowListView(ListView):
return
queryset
class
ShowDetailView
(
DetailView
):
queryset
=
Show
.
objects
.
filter
(
is_active
=
True
).
exclude
(
id
=
1
).
distinct
()
template_name
=
'
show_detail.html
'
class
TimeSlotDetailView
(
DetailView
):
queryset
=
TimeSlot
.
objects
.
all
()
template_name
=
'
timeslot_detail.html
'
class
RecommendationsListView
(
ListView
):
context_object_name
=
'
recommendation_list
'
template_name
=
'
recommendation_list.html
'
...
...
@@ -43,7 +70,7 @@ class RecommendationsListView(ListView):
class
RecommendationsBoxView
(
RecommendationsListView
):
template_name
=
'
boxes/recommendation.html
'
template_name
=
'
boxes/recommendation.html
'
class
DayScheduleView
(
TemplateView
):
...
...
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