From: Emilie Date: Fri, 14 Oct 2016 15:59:27 +0000 (+0200) Subject: Search : adapt to playlist X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=c6c5f0aa12b06b7311b3ac64ed78eac979721100;p=mezzo.git Search : adapt to playlist --- diff --git a/app/local_settings.py b/app/local_settings.py index b1390f8b..466df445 100644 --- a/app/local_settings.py +++ b/app/local_settings.py @@ -132,7 +132,7 @@ SEARCH_MODEL_CHOICES = ('organization-pages.CustomPage', 'organization-network.TeamPage', 'organization-projects.ProjectTopicPage', 'pages.Page', - 'organization-media.Media', + 'organization-media.Playlist', 'mezzanine_agenda.Event') diff --git a/app/organization/core/views.py b/app/organization/core/views.py index 2b7bda42..08084b29 100644 --- a/app/organization/core/views.py +++ b/app/organization/core/views.py @@ -56,17 +56,12 @@ class CustomSearchView(TemplateView): # aggregate all Page types : CustomPage, TeamPage, Topic etc... if result._meta.get_parent_list() : parent_class = result._meta.get_parent_list()[0] - if full_classname in settings.PAGES_MODELS: classname = "CustomPage" verbose_name = "Page" app_label = "organization-pages" - elif "Video" in parent_class.__name__: - classname = "Video" - app_label = parent_class._meta.app_label - elif "Audio" in parent_class.__name__: - classname = "Audio" - app_label = parent_class._meta.app_label + elif classname == "Playlist": + verbose_name = "Media" if classname in filter_dict: filter_dict[classname]['count'] += 1 diff --git a/app/templates/media/inc/playlist_search.html b/app/templates/media/inc/playlist_search.html new file mode 100644 index 00000000..0ab4d8f3 --- /dev/null +++ b/app/templates/media/inc/playlist_search.html @@ -0,0 +1,26 @@ +{% load i18n mezzanine_tags organization_tags %} +{% with playlist.get_absolute_url as playlist_url %} + {% if playlist.medias.first.media.poster_url %} + + + {% else %} + + {% endif %} + + {{ playlist.type }} + +
+ {% if playlist_url %} + {{ playlist.title }} + {% else %} + {{ playlist }} + {% endif %} +
+ {% if playlist.description != playlist|stringformat:"s" %} +

{{ playlist.description|truncatewords_html:200|safe }}

+ {% endif %} + {% if playlist_url %} + {% trans "read more" %} + {% endif %} +
+{% endwith %} diff --git a/app/templates/search_results.html b/app/templates/search_results.html index b211c490..8603cf68 100644 --- a/app/templates/search_results.html +++ b/app/templates/search_results.html @@ -47,17 +47,14 @@ {% endif %}

{% for result in results.object_list %} + {{ result|classname }} {% if result|classname == 'Event' %} {% with result as event %} {% include 'agenda/includes/event_search.html' %} {% endwith %} - {% elif result|classname == 'Audio' %} - {% with result as audio %} - {% include 'media/audio/inc/audio_search.html' %} - {% endwith %} - {% elif result|classname == 'Video' %} - {% with result as video %} - {% include 'media/video/inc/video_search.html' %} + {% elif result|classname == 'Playlist' %} + {% with result as playlist %} + {% include 'media/inc/playlist_search.html' %} {% endwith %} {% else %} {% with result as page %}