Previous diffusions; website styles; small templates change; VerboseFrequency
This commit is contained in:
@ -3,6 +3,7 @@ from django.template.loader import render_to_string
|
||||
from django.views.generic import ListView
|
||||
from django.views.generic import DetailView
|
||||
from django.core import serializers
|
||||
from django.utils import timezone as tz
|
||||
from django.utils.translation import ugettext as _, ugettext_lazy
|
||||
|
||||
import aircox_programs.models as programs
|
||||
@ -11,7 +12,6 @@ from aircox_cms.views import Sections
|
||||
from website.models import *
|
||||
|
||||
|
||||
|
||||
class PlayListSection (Sections.List):
|
||||
title = _('Playlist')
|
||||
|
||||
@ -22,7 +22,6 @@ class PlayListSection (Sections.List):
|
||||
return [ Sections.List.Item(None, track.title, track.artist)
|
||||
for track in tracks ]
|
||||
|
||||
|
||||
class ScheduleSection (Sections.List):
|
||||
title = _('Schedule')
|
||||
|
||||
@ -36,11 +35,34 @@ class ScheduleSection (Sections.List):
|
||||
for sched in scheds
|
||||
]
|
||||
|
||||
|
||||
class EpisodesSection (Sections.Posts):
|
||||
title = _('Episodes')
|
||||
|
||||
def get_object_list (self):
|
||||
return Episode.objects.filter(related__program = self.object.pk)
|
||||
return Episode.objects.filter(related__program = self.object.related.pk)
|
||||
|
||||
class PreviousDiffusions (Sections.Posts):
|
||||
title = _('Previous Diffusions')
|
||||
fields = ['title', 'time']
|
||||
|
||||
def get_object_list (self):
|
||||
diffusions = programs.Diffusion.objects\
|
||||
.filter(date__lt = tz.datetime.now())
|
||||
episodes = []
|
||||
|
||||
for diffusion in diffusions:
|
||||
if not diffusion.episode:
|
||||
continue
|
||||
|
||||
post = Episode.objects.filter(related = diffusion.episode.pk)
|
||||
if not post:
|
||||
continue
|
||||
post = post[0]
|
||||
post.date = diffusion.date
|
||||
episodes.append(post)
|
||||
if len(episodes) == self.paginate_by:
|
||||
break
|
||||
|
||||
return episodes
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user