remove get_content() function in sections; add is_empty() and message_empty() for all sections + hiding if needed; adapt; section Content is now child of Image; remove print()

This commit is contained in:
bkfox
2016-07-09 00:05:11 +02:00
parent 160a5db500
commit 733acf20ef
4 changed files with 78 additions and 68 deletions

View File

@ -46,7 +46,6 @@ class AddToPlaylist(Action):
from aircox.programs.models import Sound
from aircox.website.models import Diffusion
print(object)
if not in_list:
return False

View File

@ -244,8 +244,8 @@ class Sounds(sections.List):
return
sounds = programs.Sound.objects.filter(
diffusion = self.object.related
# public = True
diffusion = self.object.related,
public = True,
).order_by('type')
return [
sections.ListItem(
@ -265,6 +265,7 @@ class Schedule(Diffusions):
date = None
nav_date_format = '%a. %d'
fields = [ 'time', 'image', 'title']
message_empty = ''
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@ -342,30 +343,3 @@ class Schedule(Diffusions):
return None
#class DatesOfDiffusion(sections.List):
# title = _('Dates of diffusion')
#
# def get_object_list(self):
# diffs = list(programs.Diffusion.objects. \
# filter(initial = self.object.related). \
# exclude(type = programs.Diffusion.Type.unconfirmed)
# )
# diffs.append(self.object.related)
#
# items = []
# for diff in sorted(diffs, key = lambda d: d.date, reverse = True):
# info = ''
# if diff.initial:
# info = _('rerun')
# if diff.type == programs.Diffusion.Type.canceled:
# info += ' ' + _('canceled')
# items.append(
# sections.List.Item(None, diff.start.strftime('%c'), info, None,
# 'canceled')
# )
# return items
#
## TODO sounds
#