diff --git a/cms/sections.py b/cms/sections.py index 598899d..699347e 100644 --- a/cms/sections.py +++ b/cms/sections.py @@ -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 = [ diff --git a/cms/views.py b/cms/views.py index 9084bb8..425c725 100644 --- a/cms/views.py +++ b/cms/views.py @@ -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 diff --git a/programs/admin.py b/programs/admin.py index 7c389f7..b625bf7 100755 --- a/programs/admin.py +++ b/programs/admin.py @@ -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 diff --git a/programs/models.py b/programs/models.py index ee92785..39063c5 100755 --- a/programs/models.py +++ b/programs/models.py @@ -78,6 +78,7 @@ class Track(Nameable): ) tags = TaggableManager( verbose_name=_('tags'), + blank=True, ) def __str__(self): diff --git a/website/admin.py b/website/admin.py index 8455809..bcc8819 100644 --- a/website/admin.py +++ b/website/admin.py @@ -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) diff --git a/website/sections.py b/website/sections.py index a911364..2c4a010 100644 --- a/website/sections.py +++ b/website/sections.py @@ -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 ]