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
b77f008e
Commit
b77f008e
authored
14 years ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
changed to TemplateView for day schedule, use one template for both views.
parent
3a764246
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/views.py
+17
-20
17 additions, 20 deletions
program/views.py
templates/program/today_schedule.html
+0
-48
0 additions, 48 deletions
templates/program/today_schedule.html
with
17 additions
and
68 deletions
program/views.py
+
17
−
20
View file @
b77f008e
...
...
@@ -50,42 +50,39 @@ class RecommendationsView(ListView):
return
Note
.
objects
.
filter
(
status
=
1
,
timeslot__start__range
=
(
now
,
in_one_week
))[:
10
]
class
TodayScheduleView
(
TodayArchiveView
):
model
=
TimeSlot
allow_future
=
True
date_field
=
'
start
'
context_object_name
=
'
timeslots
'
template_name
=
'
program/today_schedule.html
'
class
TodayScheduleView
(
TemplateView
):
template_name
=
'
program/day_schedule.html
'
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
TodayScheduleView
,
self
).
get_context_data
(
**
kwargs
)
now
=
datetime
.
now
()
midnight
=
datetime
.
combine
(
date
.
today
(),
time
(
23
,
59
))
today
=
datetime
.
combine
(
date
.
today
(),
time
(
6
,
0
))
tomorrow
=
datetime
.
combine
(
date
.
today
()
+
timedelta
(
days
=
1
),
time
(
6
,
0
))
context
[
'
broadcastformats
'
]
=
BroadcastFormat
.
objects
.
all
()
context
[
'
recommendations
'
]
=
Note
.
objects
.
filter
(
status
=
1
,
timeslot__start__range
=
(
now
,
midnight
))
context
[
'
recommendations
'
]
=
Note
.
objects
.
filter
(
status
=
1
,
timeslot__start__range
=
(
now
,
tomorrow
))
context
[
'
timeslots
'
]
=
TimeSlot
.
objects
.
filter
(
start__range
=
(
today
,
tomorrow
))
return
context
class
DayScheduleView
(
DayArchiveView
):
model
=
TimeSlot
allow_future
=
True
date_field
=
'
start
'
month_format
=
'
%m
'
context_object_name
=
'
timeslots
'
class
DayScheduleView
(
TemplateView
):
template_name
=
'
program/day_schedule.html
'
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
DayScheduleView
,
self
).
get_context_data
(
**
kwargs
)
year
,
month
,
day
=
map
(
int
,
[
self
.
get_year
(),
self
.
get_month
(),
self
.
get_day
()])
this_day
=
datetime
(
year
,
month
,
day
,
0
,
0
)
midnight
=
datetime
(
year
,
month
,
day
,
23
,
59
)
context
[
'
broadcastformats
'
]
=
BroadcastFormat
.
objects
.
all
()
context
[
'
recommendations
'
]
=
Note
.
objects
.
filter
(
status
=
1
,
timeslot__start__range
=
(
this_day
,
midnight
))
year
=
context
[
'
params
'
][
'
year
'
]
month
=
context
[
'
params
'
][
'
month
'
]
day
=
context
[
'
params
'
][
'
day
'
]
# start the day at 6
this_day
=
datetime
.
strptime
(
'
%s__%s__%s__06__00
'
%
(
year
,
month
,
day
),
'
%Y__%m__%d__%H__%M
'
)
that_day
=
this_day
+
timedelta
(
days
=
1
)
context
[
'
broadcastformats
'
]
=
BroadcastFormat
.
objects
.
all
()
context
[
'
recommendations
'
]
=
Note
.
objects
.
filter
(
status
=
1
,
timeslot__start__range
=
(
this_day
,
that_day
))
context
[
'
timeslots
'
]
=
TimeSlot
.
objects
.
filter
(
start__range
=
(
this_day
,
that_day
))
return
context
class
CurrentShowView
(
TemplateView
):
...
...
This diff is collapsed.
Click to expand it.
templates/program/today_schedule.html
deleted
100644 → 0
+
0
−
48
View file @
3a764246
<div
id=
"calendar"
>
</div>
<div
id=
"recommendations"
>
{% for recommendation in recommendations %}
<div>
{{ recommendation.timeslot.start|date:"H:i" }}
</div>
<div>
{{ recommendation.timeslot.programslot.show.name }}
</div>
<div><a
href=
"{% url timeslot-detail recommendation.timeslot.id %}"
>
{{ recommendation.title }}
</a></div>
{% endfor %}
</div>
<div>
{% for timeslot in timeslots %}
<div>
<span
class=
"time"
>
{{ timeslot.start|date:"H:i" }}
</span>
<span
class=
"abbrev"
>
{% for showinformation in timeslot.programslot.show.showinformation.all %}
{{ showinformation.abbrev }}
{% endfor %}
</span>
<span
class=
"abbrev"
>
{% for showtopic in timeslot.programslot.show.showtopic.all %}
{{ showtopic.abbrev }}
{% endfor %}
</span>
<span
class=
"abbrev"
>
{% for musicfocus in timeslot.programslot.show.musicfocus.all %}
{{ musicfocus.abbrev }}
{% endfor %}
</span>
<span
class=
"timeslot"
>
<a
href=
"{% url timeslot-detail timeslot.id %}"
>
{{ timeslot.show }}
</a>
{% if timeslot.note %}
<span>
Heute: {{ timeslot.note.title }}
</span>
{% endif %}
</span>
{% endfor %}
</div>
<div>
{% for broadcastformat in broadcastformats %}
<div>
{{ broadcastformat }}
</div>
{% endfor %}
</div>
\ No newline at end of file
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