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
66de5f8e
Commit
66de5f8e
authored
12 years ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
moved CSS generation to program application.
parent
763d8a04
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
program/admin.py
+7
-5
7 additions, 5 deletions
program/admin.py
program/models.py
+94
-0
94 additions, 0 deletions
program/models.py
program/urls.py
+2
-1
2 additions, 1 deletion
program/urls.py
program/views.py
+8
-0
8 additions, 0 deletions
program/views.py
with
111 additions
and
6 deletions
program/admin.py
+
7
−
5
View file @
66de5f8e
...
@@ -2,23 +2,25 @@ from django.contrib import admin
...
@@ -2,23 +2,25 @@ from django.contrib import admin
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
models
import
BroadcastFormat
,
MusicFocus
,
ShowInformation
,
ShowTopic
,
Host
,
Note
,
ProgramSlot
,
Show
,
TimeSlot
from
models
import
BroadcastFormat
,
MusicFocus
,
ShowInformation
,
ShowTopic
,
Host
,
Note
,
ProgramSlot
,
Show
,
TimeSlot
from
forms
import
MusicFocusForm
from
datetime
import
date
from
datetime
import
date
class
BroadcastFormatAdmin
(
admin
.
ModelAdmin
):
class
BroadcastFormatAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'
format
'
,)
list_display
=
(
'
format
'
,
'
enabled
'
,
'
admin_color
'
)
prepopulated_fields
=
{
'
slug
'
:
(
'
format
'
,)}
prepopulated_fields
=
{
'
slug
'
:
(
'
format
'
,)}
class
MusicFocusAdmin
(
admin
.
ModelAdmin
):
class
MusicFocusAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'
focus
'
,
'
abbrev
'
)
form
=
MusicFocusForm
list_display
=
(
'
focus
'
,
'
abbrev
'
,
'
admin_button
'
)
prepopulated_fields
=
{
'
slug
'
:
(
'
focus
'
,)}
prepopulated_fields
=
{
'
slug
'
:
(
'
focus
'
,)}
class
ShowInformationAdmin
(
admin
.
ModelAdmin
):
class
ShowInformationAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'
information
'
,
'
abbrev
'
)
list_display
=
(
'
information
'
,
'
abbrev
'
,
'
admin_button
'
)
prepopulated_fields
=
{
'
slug
'
:
(
'
information
'
,)}
prepopulated_fields
=
{
'
slug
'
:
(
'
information
'
,)}
class
ShowTopicAdmin
(
admin
.
ModelAdmin
):
class
ShowTopicAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'
topic
'
,
'
abbrev
'
)
list_display
=
(
'
topic
'
,
'
abbrev
'
,
'
admin_button
'
)
prepopulated_fields
=
{
'
slug
'
:
(
'
topic
'
,)}
prepopulated_fields
=
{
'
slug
'
:
(
'
topic
'
,)}
class
NoteAdmin
(
admin
.
ModelAdmin
):
class
NoteAdmin
(
admin
.
ModelAdmin
):
...
@@ -80,4 +82,4 @@ admin.site.register(Note, NoteAdmin)
...
@@ -80,4 +82,4 @@ admin.site.register(Note, NoteAdmin)
admin
.
site
.
register
(
ProgramSlot
,
ProgramSlotAdmin
)
admin
.
site
.
register
(
ProgramSlot
,
ProgramSlotAdmin
)
admin
.
site
.
register
(
Show
,
ShowAdmin
)
admin
.
site
.
register
(
Show
,
ShowAdmin
)
admin
.
site
.
register
(
Host
)
admin
.
site
.
register
(
Host
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
program/models.py
+
94
−
0
View file @
66de5f8e
...
@@ -12,12 +12,19 @@ from dateutil.rrule import rrule
...
@@ -12,12 +12,19 @@ from dateutil.rrule import rrule
class
BroadcastFormat
(
models
.
Model
):
class
BroadcastFormat
(
models
.
Model
):
format
=
models
.
CharField
(
_
(
"
Format
"
),
max_length
=
32
)
format
=
models
.
CharField
(
_
(
"
Format
"
),
max_length
=
32
)
slug
=
models
.
SlugField
(
_
(
"
Slug
"
),
max_length
=
32
,
unique
=
True
)
slug
=
models
.
SlugField
(
_
(
"
Slug
"
),
max_length
=
32
,
unique
=
True
)
color
=
models
.
CharField
(
_
(
"
Color
"
),
max_length
=
7
,
default
=
'
#ffffff
'
)
enabled
=
models
.
BooleanField
(
_
(
"
Enabled
"
),
default
=
True
)
class
Meta
:
class
Meta
:
ordering
=
(
'
format
'
,)
ordering
=
(
'
format
'
,)
verbose_name
=
_
(
"
Broadcast format
"
)
verbose_name
=
_
(
"
Broadcast format
"
)
verbose_name_plural
=
_
(
"
Broadcast formats
"
)
verbose_name_plural
=
_
(
"
Broadcast formats
"
)
def
admin_color
(
self
):
return
u
'
<span style=
"
background-color:%s; padding: 0.2em
"
>%s</span>
'
%
(
self
.
color
,
self
.
color
)
admin_color
.
short_description
=
_
(
"
Color
"
)
admin_color
.
allow_tags
=
True
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
u
'
%s
'
%
self
.
format
return
u
'
%s
'
%
self
.
format
...
@@ -25,12 +32,41 @@ class ShowInformation(models.Model):
...
@@ -25,12 +32,41 @@ class ShowInformation(models.Model):
information
=
models
.
CharField
(
_
(
"
Information
"
),
max_length
=
32
)
information
=
models
.
CharField
(
_
(
"
Information
"
),
max_length
=
32
)
abbrev
=
models
.
CharField
(
_
(
"
Abbreviation
"
),
max_length
=
4
,
unique
=
True
)
abbrev
=
models
.
CharField
(
_
(
"
Abbreviation
"
),
max_length
=
4
,
unique
=
True
)
slug
=
models
.
SlugField
(
_
(
"
Slug
"
),
max_length
=
32
,
unique
=
True
)
slug
=
models
.
SlugField
(
_
(
"
Slug
"
),
max_length
=
32
,
unique
=
True
)
button
=
models
.
ImageField
(
_
(
"
Button image
"
),
blank
=
True
,
null
=
True
,
upload_to
=
'
buttons
'
)
button_hover
=
models
.
ImageField
(
_
(
"
Button image (hover)
"
),
blank
=
True
,
null
=
True
,
upload_to
=
'
buttons
'
)
big_button
=
models
.
ImageField
(
_
(
"
Big button image
"
),
blank
=
True
,
null
=
True
,
upload_to
=
'
buttons
'
)
class
Meta
:
class
Meta
:
ordering
=
(
'
information
'
,)
ordering
=
(
'
information
'
,)
verbose_name
=
_
(
"
Show information
"
)
verbose_name
=
_
(
"
Show information
"
)
verbose_name_plural
=
_
(
"
Show information
"
)
verbose_name_plural
=
_
(
"
Show information
"
)
def
admin_button
(
self
):
if
self
.
button
:
return
u
'
<img src=
"
%s
"
/>
'
%
self
.
button
.
url
else
:
return
u
'
(no button)
'
admin_button
.
short_description
=
_
(
"
Button
"
)
admin_button
.
allow_tags
=
True
def
button_url
(
self
):
if
self
.
button
:
return
self
.
button
.
url
else
:
return
'
/site_media/buttons/default-11.png
'
def
button_hover_url
(
self
):
if
self
.
button_hover
:
return
self
.
button_hover
.
url
else
:
return
'
/site_media/buttons/default-11.png
'
def
big_button_url
(
self
):
if
self
.
big_button
:
return
self
.
big_button
.
url
else
:
return
'
/site_media/buttons/default-17.png
'
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
u
'
%s
'
%
self
.
information
return
u
'
%s
'
%
self
.
information
...
@@ -38,12 +74,41 @@ class ShowTopic(models.Model):
...
@@ -38,12 +74,41 @@ class ShowTopic(models.Model):
topic
=
models
.
CharField
(
_
(
"
Show topic
"
),
max_length
=
32
)
topic
=
models
.
CharField
(
_
(
"
Show topic
"
),
max_length
=
32
)
abbrev
=
models
.
CharField
(
_
(
"
Abbreviation
"
),
max_length
=
4
,
unique
=
True
)
abbrev
=
models
.
CharField
(
_
(
"
Abbreviation
"
),
max_length
=
4
,
unique
=
True
)
slug
=
models
.
SlugField
(
_
(
"
Slug
"
),
max_length
=
32
,
unique
=
True
)
slug
=
models
.
SlugField
(
_
(
"
Slug
"
),
max_length
=
32
,
unique
=
True
)
button
=
models
.
ImageField
(
_
(
"
Button image
"
),
blank
=
True
,
null
=
True
,
upload_to
=
'
buttons
'
)
button_hover
=
models
.
ImageField
(
_
(
"
Button image (hover)
"
),
blank
=
True
,
null
=
True
,
upload_to
=
'
buttons
'
)
big_button
=
models
.
ImageField
(
_
(
"
Big button image
"
),
blank
=
True
,
null
=
True
,
upload_to
=
'
buttons
'
)
class
Meta
:
class
Meta
:
ordering
=
(
'
topic
'
,)
ordering
=
(
'
topic
'
,)
verbose_name
=
_
(
"
Show topic
"
)
verbose_name
=
_
(
"
Show topic
"
)
verbose_name_plural
=
_
(
"
Show topics
"
)
verbose_name_plural
=
_
(
"
Show topics
"
)
def
admin_button
(
self
):
if
self
.
button
:
return
u
'
<img src=
"
%s
"
/>
'
%
self
.
button
.
url
else
:
return
u
'
(no button)
'
admin_button
.
short_description
=
_
(
"
Button
"
)
admin_button
.
allow_tags
=
True
def
button_url
(
self
):
if
self
.
button
:
return
self
.
button
.
url
else
:
return
'
/site_media/buttons/default-11.png
'
def
button_hover_url
(
self
):
if
self
.
button_hover
:
return
self
.
button_hover
.
url
else
:
return
'
/site_media/buttons/default-11.png
'
def
big_button_url
(
self
):
if
self
.
big_button
:
return
self
.
big_button
.
url
else
:
return
'
/site_media/buttons/default-17.png
'
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
u
'
%s
'
%
self
.
topic
return
u
'
%s
'
%
self
.
topic
...
@@ -51,12 +116,41 @@ class MusicFocus(models.Model):
...
@@ -51,12 +116,41 @@ class MusicFocus(models.Model):
focus
=
models
.
CharField
(
_
(
"
Focus
"
),
max_length
=
32
)
focus
=
models
.
CharField
(
_
(
"
Focus
"
),
max_length
=
32
)
abbrev
=
models
.
CharField
(
_
(
"
Abbreviation
"
),
max_length
=
4
,
unique
=
True
)
abbrev
=
models
.
CharField
(
_
(
"
Abbreviation
"
),
max_length
=
4
,
unique
=
True
)
slug
=
models
.
SlugField
(
_
(
"
Slug
"
),
max_length
=
32
,
unique
=
True
)
slug
=
models
.
SlugField
(
_
(
"
Slug
"
),
max_length
=
32
,
unique
=
True
)
button
=
models
.
ImageField
(
_
(
"
Button image
"
),
blank
=
True
,
null
=
True
,
upload_to
=
'
buttons
'
)
button_hover
=
models
.
ImageField
(
_
(
"
Button image (hover)
"
),
blank
=
True
,
null
=
True
,
upload_to
=
'
buttons
'
)
big_button
=
models
.
ImageField
(
_
(
"
Big button image
"
),
blank
=
True
,
null
=
True
,
upload_to
=
'
buttons
'
)
class
Meta
:
class
Meta
:
ordering
=
(
'
focus
'
,)
ordering
=
(
'
focus
'
,)
verbose_name
=
_
(
"
Music focus
"
)
verbose_name
=
_
(
"
Music focus
"
)
verbose_name_plural
=
_
(
"
Music focus
"
)
verbose_name_plural
=
_
(
"
Music focus
"
)
def
admin_button
(
self
):
if
self
.
button
:
return
u
'
<img src=
"
%s
"
/>
'
%
self
.
button
.
url
else
:
return
u
'
(no button)
'
admin_button
.
short_description
=
_
(
"
Button
"
)
admin_button
.
allow_tags
=
True
def
button_url
(
self
):
if
self
.
button
:
return
self
.
button
.
url
else
:
return
'
/site_media/buttons/default-11.png
'
def
button_hover_url
(
self
):
if
self
.
button_hover
:
return
self
.
button_hover
.
url
else
:
return
'
/site_media/buttons/default-11.png
'
def
big_button_url
(
self
):
if
self
.
big_button
:
return
self
.
big_button
.
url
else
:
return
'
/site_media/buttons/default-17.png
'
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
u
'
%s
'
%
self
.
focus
return
u
'
%s
'
%
self
.
focus
...
...
This diff is collapsed.
Click to expand it.
program/urls.py
+
2
−
1
View file @
66de5f8e
...
@@ -4,7 +4,7 @@ from django.views.decorators.cache import cache_page
...
@@ -4,7 +4,7 @@ from django.views.decorators.cache import cache_page
from
django.views.generic.list_detail
import
object_detail
,
object_list
from
django.views.generic.list_detail
import
object_detail
,
object_list
from
models
import
Host
,
Show
,
TimeSlot
from
models
import
Host
,
Show
,
TimeSlot
from
views
import
current_show
,
day_schedule
,
recommendations
,
show_list
,
week_schedule
from
views
import
current_show
,
day_schedule
,
recommendations
,
show_list
,
week_schedule
,
styles
from
datetime
import
date
from
datetime
import
date
...
@@ -35,6 +35,7 @@ urlpatterns = patterns('',
...
@@ -35,6 +35,7 @@ urlpatterns = patterns('',
url
(
r
'
^shows/(?P<slug>[\w-]+)/?$
'
,
object_detail
,
shows_dict
,
name
=
'
show-detail
'
),
url
(
r
'
^shows/(?P<slug>[\w-]+)/?$
'
,
object_detail
,
shows_dict
,
name
=
'
show-detail
'
),
url
(
r
'
^(?P<object_id>\d+)/?$
'
,
object_detail
,
timeslots_dict
,
name
=
'
timeslot-detail
'
),
url
(
r
'
^(?P<object_id>\d+)/?$
'
,
object_detail
,
timeslots_dict
,
name
=
'
timeslot-detail
'
),
url
(
r
'
^week/?$
'
,
week_schedule
),
url
(
r
'
^week/?$
'
,
week_schedule
),
url
(
r
'
^styles.css$
'
,
styles
),
)
)
if
settings
.
DEBUG
:
if
settings
.
DEBUG
:
...
...
This diff is collapsed.
Click to expand it.
program/views.py
+
8
−
0
View file @
66de5f8e
...
@@ -119,3 +119,11 @@ def week_schedule(request, year=None, week=None):
...
@@ -119,3 +119,11 @@ def week_schedule(request, year=None, week=None):
extra_context
[
'
next_w4
'
]
=
datetime
.
strftime
(
monday
+
timedelta
(
days
=
28
),
'
%Y/%W
'
)
extra_context
[
'
next_w4
'
]
=
datetime
.
strftime
(
monday
+
timedelta
(
days
=
28
),
'
%Y/%W
'
)
return
simple
.
direct_to_template
(
request
,
template
=
'
program/week_schedule.html
'
,
extra_context
=
extra_context
)
return
simple
.
direct_to_template
(
request
,
template
=
'
program/week_schedule.html
'
,
extra_context
=
extra_context
)
def
styles
(
request
):
extra_context
=
dict
()
extra_context
[
'
broadcastformats
'
]
=
BroadcastFormat
.
objects
.
filter
(
enabled
=
True
)
extra_context
[
'
musicfocus
'
]
=
MusicFocus
.
objects
.
all
()
extra_context
[
'
showinformation
'
]
=
ShowInformation
.
objects
.
all
()
extra_context
[
'
showtopic
'
]
=
ShowTopic
.
objects
.
all
()
return
simple
.
direct_to_template
(
request
,
template
=
'
program/styles.css
'
,
mimetype
=
'
text/css
'
,
extra_context
=
extra_context
)
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