check section playlist
This commit is contained in:
parent
83e425349b
commit
13bf57b401
|
@ -96,7 +96,7 @@ class Section(Viewable, View):
|
|||
|
||||
def add_css_class(self, css_class):
|
||||
if self.css_class:
|
||||
if css_class not in self.css_class:
|
||||
if css_class not in self.css_class.split(' '):
|
||||
self.css_class += ' ' + css_class
|
||||
else:
|
||||
self.css_class = css_class
|
||||
|
@ -255,8 +255,6 @@ class List(Section):
|
|||
"""
|
||||
super().__init__(*args, **kwargs)
|
||||
self.add_css_class('list')
|
||||
if type(self) != Section:
|
||||
self.add_css_class('section_' + type(self).__name__.lower())
|
||||
|
||||
if items:
|
||||
self.object_list = [
|
||||
|
|
|
@ -32,7 +32,7 @@ class PostBaseView:
|
|||
Add the given class to the current class list if not yet present.
|
||||
"""
|
||||
if self.css_class:
|
||||
if css_class not in self.css_class:
|
||||
if css_class not in self.css_class.split(' '):
|
||||
self.css_class += ' ' + css_class
|
||||
else:
|
||||
self.css_class = css_class
|
||||
|
|
|
@ -132,7 +132,7 @@ class DiffusionAdmin(admin.ModelAdmin):
|
|||
We want rerun to redirect to the given object.
|
||||
"""
|
||||
obj = super().get_object(*args, **kwargs)
|
||||
if obj.initial:
|
||||
if obj and obj.initial:
|
||||
obj = obj.initial
|
||||
return obj
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ class Track(Nameable):
|
|||
)
|
||||
tags = TaggableManager(
|
||||
verbose_name=_('tags'),
|
||||
blank=True,
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
@ -14,9 +14,11 @@ class TrackInline(SortableTabularInline):
|
|||
sortable = 'position'
|
||||
extra = 10
|
||||
|
||||
|
||||
admin.site.register(models.Program, cms.RelatedPostAdmin)
|
||||
admin.site.register(models.Diffusion, cms.RelatedPostAdmin)
|
||||
|
||||
cms.inject_related_inline(models.Program, True)
|
||||
cms.inject_inline(programs.Diffusion, TrackInline, True)
|
||||
cms.inject_related_inline(models.Diffusion, True)
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ class Playlist(sections.List):
|
|||
tracks = programs.Track.objects \
|
||||
.filter(diffusion = self.object.related) \
|
||||
.order_by('position')
|
||||
return [ sections.ListItem(title=track.title, content=track.artist)
|
||||
return [ sections.ListItem(title=track.name, content=track.artist)
|
||||
for track in tracks ]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user