Commit 8be0cfa1 authored by Jocelyn Delalande's avatar Jocelyn Delalande
Browse files

Corrige les 500 sur clic sur « éditer en ligne »

Depuis le passage à Django 1.9.
En profite pour utiliser une syntaxe non dépréciée pour le fichier URLS et
simplifier les url()

Fix #81
parent 46985ca4
......@@ -25,9 +25,9 @@
<ul>
{% if original.fichier_source %}
<li><strong><a href="compiler/" />Compiler</a></strong></li>
<li><strong><a href="{% url 'compiler' id=original.id %}">Compiler</a></strong></li>
{% endif %}
<li><strong><a href="editeur/" />Éditer le texte en ligne</a></strong></li>
<li><strong><a href="{% url 'source_edit' id=original.id %}">Éditer le texte en ligne</a></strong></li>
</ul>
{% endif %}
......
# -*- coding: utf-8 -*-
from django.contrib.admin.views.main import *
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls import include, url
from django.contrib import auth, admin
from django.views.generic import RedirectView, TemplateView
from django.views.static import serve
from articles.views import (
ArticleDetailView, EventListView, PublicationListView)
from bugreport.views import (
fix_edit,
signaler_erreur_page,
merci,
signaler_erreur_texte,
)
from texte.views import (
AuthorListView, AuthorDetailView, LinkListView,
TagDetailView, TextListView)
TagDetailView, TextListView, compiler, source_edit, commenter,
ajax_commenter, page_en_ligne, telecharger)
admin.autodiscover()
urlpatterns = patterns('texte.views',
(r'^admin/([^/]+)/([^/]+)/(?P<id>.+)/compiler/$', 'compiler'),
(r'^admin/([^/]+)/([^/]+)/(?P<id>.+)/editeur/$', 'source_edit'),
)
urlpatterns = [
url(r'^admin/texte/texte//(?P<id>.+)/compiler/$', compiler, name='compiler'),
url(r'^admin/texte/texte/(?P<id>.+)/editeur/$', source_edit, name='source_edit'),
]
urlpatterns += patterns('bugreport.views',
(r'^admin/bugreport/rapporterreur/(?P<no_bug>\d+)/$', 'fix_edit'),
)
urlpatterns += [
url(r'^admin/bugreport/rapporterreur/(?P<no_bug>\d+)/$', fix_edit),
]
urlpatterns += patterns(
'django.views',
urlpatterns += [
# Accueil
(r'^$', TemplateView.as_view(template_name='accueil.html')),
(r'^apropos/$', TemplateView.as_view(template_name='apropos.html')),
url(r'^$', TemplateView.as_view(template_name='accueil.html')),
url(r'^apropos/$', TemplateView.as_view(template_name='apropos.html')),
# Admin
(r'^admin/', include(admin.site.urls)),
url(r'^admin/', include(admin.site.urls)),
# Contenu statique
(r'^site_media/(?P<path>.*)$', 'static.serve',
url(r'^site_media/(?P<path>.*)$', serve,
{'document_root': settings.MEDIA_ROOT}),
# Textes
(r'^textes/$', TextListView.as_view()),
(r'^textes/(?P<slug>[-\w]+)/lire/$', RedirectView.as_view(
url(r'^textes/$', TextListView.as_view()),
url(r'^textes/(?P<slug>[-\w]+)/lire/$', RedirectView.as_view(
url='1/', permanent=True)),
(r'^textes/(?P<slug>[-\w]+)/$', RedirectView.as_view(
url(r'^textes/(?P<slug>[-\w]+)/$', RedirectView.as_view(
url='lire/1/', permanent=True)),
# Auteurs
(r'^auteurs/$', AuthorListView.as_view()),
(r'^auteur/(?P<slug>\w+)/$', AuthorDetailView.as_view()),
url(r'^auteurs/$', AuthorListView.as_view()),
url(r'^auteur/(?P<slug>\w+)/$', AuthorDetailView.as_view()),
# Liens
(r'^amis/$', LinkListView.as_view()),
url(r'^amis/$', LinkListView.as_view()),
# Tags, détail
(r'^tag/(?P<slug>[-\w]+)/$', TagDetailView.as_view()),
)
url(r'^tag/(?P<slug>[-\w]+)/$', TagDetailView.as_view()),
]
# Syndication rss
urlpatterns += patterns('',
urlpatterns += [
url(r'^abonnements/', include('subscriptions.urls')),
)
]
urlpatterns += patterns('texte.views',
(r'^textes/(?P<slug>[-\w]+)/commenter/(?P<no_page>\d+)/?$','commenter'),
(r'^textes/(?P<slug>[-\w]+)/ajax/commenter/$','ajax_commenter'),
(r'^textes/(?P<slug>[-\w]+)/lire/(?P<no_page>\d+)/?$','page_en_ligne'),
(r'^textes/(?P<slug>[-\w]+)/telecharger/$','telecharger'),
)
urlpatterns += [
url(r'^textes/(?P<slug>[-\w]+)/commenter/(?P<no_page>\d+)/?$', commenter),
url(r'^textes/(?P<slug>[-\w]+)/ajax/commenter/$', ajax_commenter),
url(r'^textes/(?P<slug>[-\w]+)/lire/(?P<no_page>\d+)/?$', page_en_ligne),
url(r'^textes/(?P<slug>[-\w]+)/telecharger/$', telecharger),
]
## Bugreports
urlpatterns += patterns('bugreport.views',
(r'^textes/(?P<slug>[-\w]+)/signaler-erreur/$','signaler_erreur_texte'),
(r'^textes/(?P<slug>[-\w]+)/signaler-erreur/(?P<no_page>\d+)/$','signaler_erreur_page'),
(r'^textes/(?P<slug>[-\w]+)/signaler-erreur/(?P<no_page>\d+)/merci/$','merci')
)
urlpatterns += [
url(r'^textes/(?P<slug>[-\w]+)/signaler-erreur/$',signaler_erreur_texte),
url(r'^textes/(?P<slug>[-\w]+)/signaler-erreur/(?P<no_page>\d+)/$',signaler_erreur_page),
url(r'^textes/(?P<slug>[-\w]+)/signaler-erreur/(?P<no_page>\d+)/merci/$',merci)
]
## Captcha from simple-captcha
urlpatterns += patterns('',
urlpatterns += [
url(r'^captcha/', include('captcha.urls')),
)
]
# Actus
urlpatterns += patterns(
'',
urlpatterns += [
url(r'^publications-papier/$', PublicationListView.as_view(),
name='paperback-list'),
url(r'^actu/(?P<slug>[-\w]+)/?$',
ArticleDetailView.as_view(), name='article-detail'),
url(r'^evenements/$', EventListView.as_view(), name='event-list'),
)
]
## Markdownx
......@@ -98,8 +104,7 @@ urlpatterns += [
#
## Legacy
#
urlpatterns += patterns(
'',
(r'^syndication/derniers-textes/$',
urlpatterns += [
url(r'^syndication/derniers-textes/$',
RedirectView.as_view(url='abonnement/rss/texts/', permanent=True)),
)
]
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