Commit 65923664 authored by fred's avatar fred

update for django 1.11

parent 014c8fb5
......@@ -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__)))
......@@ -96,13 +95,6 @@ STATICFILES_FINDERS = (
# Make this unique, and don't share it with anybody.
SECRET_KEY = '3qm&@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',
......@@ -117,10 +109,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'
......@@ -146,7 +155,6 @@ INSTALLED_APPS = (
'panikweb.paniktags',
'compressor',
'sorl.thumbnail',
'jquery',
'ckeditor',
'emissions',
'newsletter',
......
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,50 +6,51 @@ 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'),
url(r'^emissions/$', 'panikweb.views.emissions', 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'),
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/$', views.emissions, name='emissions'),
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')),
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()
......@@ -57,7 +58,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 *
......
......@@ -8,7 +8,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
......@@ -23,7 +23,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
......@@ -625,7 +624,6 @@ listen = Listen.as_view()
@cache_control(max_age=15)
@csrf_exempt
@to_json('api')
def onair(request):
d = whatsonair()
if d.get('episode'):
......@@ -652,7 +650,7 @@ def onair(request):
d.update(get_current_nonstop_track())
if d.get('current_slot'):
del d['current_slot']
return d
return JsonResponse(d)
class NewsItemDetailView(DetailView):
......
......@@ -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>
......
......@@ -22,15 +22,15 @@
{% 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 %}
......
{% 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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment