]> git.0d.be Git - panikweb.git/commitdiff
update for django 1.11
authorFrédéric Péters <fpeters@0d.be>
Sun, 27 Jan 2019 18:58:03 +0000 (19:58 +0100)
committerFrédéric Péters <fpeters@0d.be>
Fri, 1 Mar 2019 12:40:56 +0000 (13:40 +0100)
panikweb/settings.py
panikweb/urls.py
panikweb/views.py
panikweb_templates/templates/emissions/nav.html
panikweb_templates/templates/episodes/resume.html
panikweb_templates/templates/includes/metaNav.html
panikweb_templates/templates/includes/week-nav.html
panikweb_templates/templates/listen/nav.html
panikweb_templates/templates/soundfiles/resume.html

index 88813b8b8fee7bc7b8faaddb6c81d33f0404499d..20b6b65c214633be8e119f073d33c360e6fca685 100644 (file)
@@ -6,7 +6,6 @@ import os
 import django.conf.global_settings as DEFAULT_SETTINGS
 
 DEBUG = True  # Turn off for production
-TEMPLATE_DEBUG = DEBUG
 DEBUG_TOOLBAR = False
 
 PROJECT_DIR = os.path.normpath(os.path.dirname(os.path.dirname(__file__)))
@@ -97,13 +96,6 @@ STATICFILES_FINDERS = (
 # Make this unique, and don't share it with anybody.
 SECRET_KEY = '3qm&amp;@6264-=st16)7_xa*ds+31e0mqqs@+*!ud7gzt$tq!b^qn'
 
-# List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = (
-    'django.template.loaders.filesystem.Loader',
-    'django.template.loaders.app_directories.Loader',
-#     'django.template.loaders.eggs.load_template_source',
-)
-
 MIDDLEWARE_CLASSES = (
     'django.middleware.cache.UpdateCacheMiddleware',
     #'django.middleware.gzip.GZipMiddleware',
@@ -118,10 +110,27 @@ MIDDLEWARE_CLASSES = (
     'django.middleware.cache.FetchFromCacheMiddleware',
 )
 
-TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + (
-    'django.core.context_processors.request',
-    'panikweb.context_processors.site_url',
-)
+TEMPLATES = [
+    {
+        'BACKEND': 'django.template.backends.django.DjangoTemplates',
+        'DIRS': [
+            os.path.join(PROJECT_DIR, 'panikweb_templates'),
+        ],
+        'APP_DIRS': True,
+        'OPTIONS': {
+            'context_processors': [
+                'django.contrib.auth.context_processors.auth',
+                'django.template.context_processors.debug',
+                'django.template.context_processors.i18n',
+                'django.template.context_processors.media',
+                'django.template.context_processors.request',
+                'django.template.context_processors.static',
+                'django.template.context_processors.tz',
+                'panikweb.context_processors.site_url',
+            ],
+        },
+    },
+]
 
 
 ROOT_URLCONF = 'panikweb.urls'
@@ -148,7 +157,6 @@ INSTALLED_APPS = (
     'panikweb.archives',
     'compressor',
     'sorl.thumbnail',
-    'jquery',
     'ckeditor',
     'emissions',
     'newsletter',
index d3d177410194b7f7a5bfc99467c17ae090fdac54..1595cc8b1319f9f01e13d5734d3e4bd45509a62b 100644 (file)
@@ -1,4 +1,4 @@
-from django.conf.urls import patterns, include, url
+from django.conf.urls import include, url
 from django.conf import settings
 
 from django.views.generic import RedirectView
@@ -6,44 +6,45 @@ from django.core.urlresolvers import reverse_lazy
 
 from django.contrib import admin
 
-urlpatterns = patterns('',
-    url(r'^$', 'panikweb.views.home', name='home'),
-    url(r'^onair.json$', 'panikweb.views.onair', name='onair'),
-    url(r'^programme/$', 'panikweb.views.program', name='program'),
-    url(r'^programme/(?P<year>\d{4})/(?P<week>\d+)/$', 'panikweb.views.program', name='program_week'),
-    url(r'^grille$', 'panikweb.views.grid', name='grid'),
+from . import search
+from . import views
+
+urlpatterns = [
+    url(r'^$', views.home, name='home'),
+    url(r'^onair.json$', views.onair, name='onair'),
+    url(r'^programme/$', views.program, name='program'),
+    url(r'^programme/(?P<year>\d{4})/(?P<week>\d+)/$', views.program, name='program_week'),
+    url(r'^grille$', views.grid, name='grid'),
     url(r'^emissions/$', RedirectView.as_view(pattern_name='home'), name='emissions'),
-    url(r'^emissions/(?P<slug>[\w,-]+)/episodes/$', 'panikweb.views.emissionEpisodes', name='emissionEpisodes'),
-    url(r'^emissions/(?P<slug>[\w,-]+)/podcasts.rss', 'panikweb.views.emission_podcasts_feed', name='emission-podcasts'),
-    url(r'^emissions/(?P<slug>[\w,-]+)/chat/$', 'panikweb.views.chat', name='emission-chat'),
-    url(r'^emissions/(?P<emission_slug>[\w,-]+)/(?P<slug>[\w,-]+)/$', 'panikweb.views.episode', name='episode-view'),
-    url(r'^emissions/(?P<emission_slug>[\w,-]+)/(?P<slug>[\w,-]+)/$', 'panikweb.views.episode', name='episode-view'),
+    url(r'^emissions/(?P<slug>[\w,-]+)/episodes/$', views.emissionEpisodes, name='emissionEpisodes'),
+    url(r'^emissions/(?P<slug>[\w,-]+)/podcasts.rss', views.emission_podcasts_feed, name='emission-podcasts'),
+    url(r'^emissions/(?P<slug>[\w,-]+)/chat/$', views.chat, name='emission-chat'),
+    url(r'^emissions/(?P<emission_slug>[\w,-]+)/(?P<slug>[\w,-]+)/$', views.episode, name='episode-view'),
     url(r'^emissions/(?P<emission_slug>[\w,-]+)/(?P<episode_slug>[\w,-]+)/embed/(?P<pk>\d+)/$',
-        'panikweb.views.soundfile_embed', name='soundfile-embed-view'),
+        views.soundfile_embed, name='soundfile-embed-view'),
     url(r'^emissions/(?P<emission_slug>[\w,-]+)/(?P<episode_slug>[\w,-]+)/dlg-embed/(?P<pk>\d+)/$',
-        'panikweb.views.soundfile_dlg_embed', name='soundfile-dialog-embed-view'),
+        views.soundfile_dlg_embed, name='soundfile-dialog-embed-view'),
     url(r'^emissions/(?P<slug>[\w,-]+)/playlist/(?P<year>[0-9]{4})-(?P<month>[-\w]+)-(?P<day>[0-9]+)/$',
-        'panikweb.views.nonstop_playlist', name='nonstop-playlist'),
-    url(r'^emissions/(?P<slug>[\w,-]+)/$', 'panikweb.views.emission', name='emission-view'),
-    url(r'^ckeditor/', include('ckeditor.urls')),
-    url(r'^emissions/archives$', 'panikweb.views.emissionsArchives', name='emissionsArchives'),
-    url(r'^sons/$', 'panikweb.views.listen', name='listen'),
-    url(r'^sons/archives/$', 'panikweb.search.listenArchives', name='listenArchives'),
-    url(r'^actus/$', 'panikweb.views.news', name='news'),
-    url(r'^actus/agenda/$', 'panikweb.views.agenda', name='agenda'),
+        views.nonstop_playlist, name='nonstop-playlist'),
+    url(r'^emissions/(?P<slug>[\w,-]+)/$', views.emission, name='emission-view'),
+    url(r'^emissions/archives$', views.emissionsArchives, name='emissionsArchives'),
+    url(r'^sons/$', views.listen, name='listen'),
+    url(r'^sons/archives/$', search.listenArchives, name='listenArchives'),
+    url(r'^actus/$', views.news, name='news'),
+    url(r'^actus/agenda/$', views.agenda, name='agenda'),
     url(r'^actus/agenda/(?P<year>[0-9]{4})/(?P<month>[0-9]+)/$',
-            'panikweb.views.agenda_by_month', name='agenda_by_month'),
+            views.agenda_by_month, name='agenda_by_month'),
     url(r'^actus/agenda$', RedirectView.as_view(pattern_name='agenda', permanent=True)),
-    url(r'^actus/archives/$', 'panikweb.search.newsArchives', name='newsArchives'),
-    url(r'^actus/(?P<slug>[\w,-]+)$', 'panikweb.views.newsitemview', name='newsitem-view'),
+    url(r'^actus/archives/$', search.newsArchives, name='newsArchives'),
+    url(r'^actus/(?P<slug>[\w,-]+)$', views.newsitemview, name='newsitem-view'),
 
-    url(r'^party', 'panikweb.views.party', name='party'),
+    url(r'^party', views.party, name='party'),
 
-    url(r'^recherche/', 'panikweb.search.view', name='search'),
+    url(r'^recherche/', search.view, name='search'),
 
-    url(r'^actus.rss', 'panikweb.views.rss_news_feed', name='rss-feed'),
-    url(r'^actus.atom', 'panikweb.views.atom_news_feed', name='atom-feed'),
-    url(r'^podcasts.rss', 'panikweb.views.podcasts_feed', name='podcasts-feed'),
+    url(r'^actus.rss', views.rss_news_feed, name='rss-feed'),
+    url(r'^actus.atom', views.atom_news_feed, name='atom-feed'),
+    url(r'^podcasts.rss', views.podcasts_feed, name='podcasts-feed'),
 
     url(r'^newsletter/', include('newsletter.urls')),
 
@@ -51,7 +52,7 @@ urlpatterns = patterns('',
 
     url(r'^admin/', include(admin.site.urls)),
     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
-)
+]
 
 from django.contrib.staticfiles.urls import staticfiles_urlpatterns
 urlpatterns += staticfiles_urlpatterns()
@@ -59,7 +60,7 @@ urlpatterns += staticfiles_urlpatterns()
 from django.conf.urls.static import static
 urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
 
-urlpatterns += patterns('', url(r'', include('combo.public.urls')))
+urlpatterns.append(url(r'', include('combo.public.urls')))
 
 try:
     from local_urls import *
index 5e2ad626274c0a90d632953ee939e21c1c377026..07abe7a38366affbe173b960539f25506f1cb7ea 100644 (file)
@@ -10,7 +10,7 @@ import urlparse
 
 from django.core.urlresolvers import reverse
 from django.conf import settings
-from django.http import Http404
+from django.http import Http404, JsonResponse
 from django.views.decorators.cache import cache_control
 from django.views.generic.base import TemplateView
 from django.views.generic.detail import DetailView
@@ -25,7 +25,6 @@ from django.contrib.syndication.views import Feed, add_domain
 from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
 
 from haystack.query import SearchQuerySet
-from jsonresponse import to_json
 
 from emissions.models import Category, Emission, Episode, Diffusion, SoundFile, \
         Schedule, Nonstop, NewsItem, NewsCategory, Focus
@@ -655,7 +654,6 @@ listen = Listen.as_view()
 
 @cache_control(max_age=15)
 @csrf_exempt
-@to_json('api')
 def onair(request):
     if datetime.now() < datetime(2018, 7, 31, 18, 0):
         return {'emission': {'title': 'À partir du 31 juillet 18h', 'url': '/'}}
@@ -685,7 +683,7 @@ def onair(request):
             d['track_title'] = open(playing_txt).read().strip()
     if d.get('current_slot'):
         del d['current_slot']
-    return d
+    return JsonResponse(d)
 
 
 class NewsItemDetailView(DetailView):
index 750767b4f6165ddfc28d2d99ddf773fb05f6e7aa..e9fd8335a17be58eb79cdf7e9c3dfaab9dd35fae 100644 (file)
@@ -4,16 +4,16 @@
     <div>
            <nav>
                    <ul class="inline padded">
-                           <li><a href="{% url 'grid' %}" class="{% if class = "grid" %}active{% endif %}">
+                           <li><a href="{% url 'grid' %}" class="{% if class == "grid" %}active{% endif %}">
                                    <span class="iconLabel">{% trans 'Grid' %}</span>
                            </a></li>
-                           <li><a href="{% url 'program' %}" class="{% if class = "program" %}active{% endif %}">
+                           <li><a href="{% url 'program' %}" class="{% if class == "program" %}active{% endif %}">
                                    <span class="iconLabel">{% trans 'By Week' %}</span>
                            </a></li>
                            <li><a href="{% url 'emissions' %}" class="{% if class != "program" and class != "grid" and class != "archives" %}active{% endif %}">
                                    <span class="iconLabel">{% trans 'Emissions' %}</span>
                            </a></li>
-                           <li><a href="{% url 'emissionsArchives' %}" class="{% if class = "archives" %}active{% endif %}">
+                           <li><a href="{% url 'emissionsArchives' %}" class="{% if class == "archives" %}active{% endif %}">
                                    <span class="iconLabel">{% trans 'Archives' %}</span>
                            </a></li>
                    </ul>
@@ -25,7 +25,7 @@
                <nav id="gridNav" class="checkable">
                        <ul class="by{{ categories.count }}">
                        {% for category in categories %}
-                               {% if class = "grid" %}
+                               {% if class == "grid" %}
                                        <li><button class="check icon-check-empty" data-about="#Main" data-highlight=".{{ category|slugify }}"><span class="category">{{ category }}</span></button></li>
                                {% else %}
                                        <li><button class="check icon-check-empty" data-about="#Main" data-toggle=".{{ category|slugify }}"><span class="category">{{ category }}</span></button></li>
index 318d1d4ee45db51a1884572ca81f776fbd30c53e..1ea8b050e97c954384557a96d2eaa2fdcebb1db7 100644 (file)
        {% endif %}
        <div class="logo">
                <a href="{% url 'episode-view' emission_slug=episode.emission.slug slug=episode.slug %}">
-               {% if model = "inline" and episode.image %}
+               {% if model == "inline" and episode.image %}
                        {% thumbnail episode.image "60x60" crop="50% 25%" as im %}
                        <img width="60" height="60" src="{{im.url}}"/>
                        {% endthumbnail %}
-               {% elif model = "inline" and episode.emission.image %}
+               {% elif model == "inline" and episode.emission.image %}
                        {% thumbnail episode.emission.image "60x60" crop="50% 25%" as im %}
                        <img width="60" height="60" src="{{im.url}}"/>
                        {% endthumbnail %}
-               {% elif model = "inline" %}
+               {% elif model == "inline" %}
                        <img class="smooth"  style="width:60px;" src="{% static "img/emission.png" %}"/>
                {% elif episode.image %}
                        {% thumbnail episode.image "150x150" crop="50% 25%" as im %}
@@ -55,7 +55,7 @@
                                <a href="{% url 'episode-view' emission_slug=episode.emission.slug slug=episode.slug %}">{{ episode.title }}</a>
                        </h5>
                        <div class="smooth metas">
-                       {% if class = "standalone" %}
+                       {% if class == "standalone" %}
                                <h5 class="title inBlock">
                                        <a href="{% url 'emission-view' slug=episode.emission.slug %}">{{ episode.emission.title }}</a>
                                </h5>
@@ -70,7 +70,7 @@
                        </div>
                </div>
 
-               {% if model = "inline" %}
+               {% if model == "inline" %}
                        <div class="description">
                        <a href="{% url 'episode-view' emission_slug=episode.emission.slug slug=episode.slug %}">
                        {% if episode.subtitle %}
index 5fc8d6b0994722068f9be019280bc813ad1543ab..c994323ebce1d5017216c9587a8c0ed04324ac30 100644 (file)
@@ -1,27 +1,27 @@
 {% load i18n %}
 <nav class="contextual-menu">
                <ul>
-                       <li class="{% if sectionName = "Home" %}active{% endif %}"><a href="{% url 'home' %}">
+                       <li class="{% if sectionName == "Home" %}active{% endif %}"><a href="{% url 'home' %}">
                                <span class="nav-icon icon-home resymbol"></span>
                                <span class="iconLabel">{% trans 'Home' %}</span>
                        </a></li>
-                       <li class="{% if sectionName = "News" %}active{% endif %}"><a title="Actualité des émissions et programmes" href="{% url 'news' %}">
+                       <li class="{% if sectionName == "News" %}active{% endif %}"><a title="Actualité des émissions et programmes" href="{% url 'news' %}">
                                <span class="nav-icon icon-bullhorn resymbol" ></span>
                                <span class="iconLabel">{% trans 'News' %}</span>
                        </a></li>
-                       <li class="{% if sectionName = "Listen" %}active{% endif %}"><a title="Derniers contenus écoutables publiés" href="{% url 'listen' %}">
+                       <li class="{% if sectionName == "Listen" %}active{% endif %}"><a title="Derniers contenus écoutables publiés" href="{% url 'listen' %}">
                                <span class="nav-icon icon-headphones resymbol" ></span>
                                <span class="iconLabel">{% trans 'Sounds' %}</span>
                        </a></li>
-                       <li class="{% if sectionName = "Topiks" %}active{% endif %}"><a href="/topiks/">
+                       <li class="{% if sectionName == "Topiks" %}active{% endif %}"><a href="/topiks/">
                                <span class="nav-icon icon-bolt" ></span>
                                <span class="iconLabel">Topiks</span>
                        </a></li>
-                       <li class="{% if sectionName = "Emissions" %}active{% endif %}"><a title="Les émissions, le programme de la semaine, la grille" href="{% url 'grid' %}">
+                       <li class="{% if sectionName == "Emissions" %}active{% endif %}"><a title="Les émissions, le programme de la semaine, la grille" href="{% url 'grid' %}">
                                <span class="nav-icon icon-calendar resymbol" ></span>
                                <span class="iconLabel">{% trans 'Program' %}</span>
                        </a></li>
-                       <li class="{% if sectionName = "About" %}active{% endif %}"><a title="Qui sommes-nous, les groupes, la charte…" href="/la-radio/">
+                       <li class="{% if sectionName == "About" %}active{% endif %}"><a title="Qui sommes-nous, les groupes, la charte…" href="/la-radio/">
                                <span class="nav-icon icon-info-sign" ></span>
                                <span class="iconLabel">{% trans 'About' %}</span>
                        </a></li>
@@ -30,7 +30,7 @@
                        /
                        <span data-lang="en"{% if LANGUAGE_CODE == 'en' %}class="lang-on"{% endif %}>EN</span>
                        </li>
-                       <li id="nav-search" class="{% if sectionName = "Search" %}active{% endif %}"><a href="{% url 'search' %}">
+                       <li id="nav-search" class="{% if sectionName == "Search" %}active{% endif %}"><a href="{% url 'search' %}">
                                <span class="nav-icon icon-search resymbol" ></span>
                        </a>
                        <form action="{% url 'search' %}"><input placeholder="{% trans 'Search' %}" name="q" type="search"></input></form>
index 8dac736ad60f4da299459f83aa89eb03e4e4a45e..2e16eabfbd1116fdf93b085a31a4621d4b46e74d 100644 (file)
@@ -4,7 +4,7 @@
                        <li class="week-arrow"><a href="{% url 'program_week' year=previous_week_year week=previous_week_no %}" 
                                class="icon-chevron-sign-left" ></a></li>
                {% for day in days %}
-                       <li class=""><button class="{% if day.datetime.weekday = weekday %}active{% endif %}" data-tab="#Program-week-{{ day.datetime|slugify }}">{{ day.datetime|date:"D d" }}</button></li>
+                       <li class=""><button class="{% if day.datetime.weekday == weekday %}active{% endif %}" data-tab="#Program-week-{{ day.datetime|slugify }}">{{ day.datetime|date:"D d" }}</button></li>
                {% endfor %}
                        <li class="week-arrow"><a href="{% url 'program_week' year=next_week_year week=next_week_no %}" 
                                class="icon-chevron-sign-right" ></a></li>
index 0dac0b8bb594142fe36a712f8486cba8205e8cca..f4de4500960f32453fdbc996ed36bb7cccb43426 100644 (file)
@@ -7,7 +7,7 @@
                                    <span class="icon-bolt" ></span>
                                    <span class="iconLabel">Derniers</span>
                            </a></li>
-                           <li><a href="{% url 'listenArchives' %}" class="{% if class = "archives" %}active{% endif %}">
+                           <li><a href="{% url 'listenArchives' %}" class="{% if class == "archives" %}active{% endif %}">
                                    <span class="icon-archive" ></span>
                                    <span class="iconLabel">Archives</span>
                            </a></li>
index d6cde2cac3f6d2869fbfe5d2203d6b61a4df9c0d..585317dc119a050a34cc2576d19dbd245b0f8706 100644 (file)
@@ -25,7 +25,7 @@
                                <a href="{% url 'episode-view' emission_slug=soundfile.episode.emission.slug slug=soundfile.episode.slug %}">{{ soundfile.title }}</a>
                        </h5>
                        {% endif %}
-                       <h5 class="title {% if model = "inline" %}ellipsis{% endif %}">
+                       <h5 class="title {% if model == "inline" %}ellipsis{% endif %}">
                                <a href="{% url 'episode-view' emission_slug=soundfile.episode.emission.slug slug=soundfile.episode.slug %}">{{ soundfile.episode.title }}</a>
                        </h5>
                        <div class="smooth metas">