From d1da8ea710af272cd2282e371c2d59ed68400a47 Mon Sep 17 00:00:00 2001 From: multigl Date: Thu, 21 Aug 2014 10:32:49 -0700 Subject: [PATCH 1/2] clean urls --- project/urls.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/project/urls.py b/project/urls.py index 83e8afb..64ed53d 100755 --- a/project/urls.py +++ b/project/urls.py @@ -4,11 +4,12 @@ admin.autodiscover() -urlpatterns = patterns('', +urlpatterns = patterns( + '', (r'^comments/', include('django.contrib.comments.urls')), (r'^admin/doc/', include('django.contrib.admindocs.urls')), (r'^admin/', include(admin.site.urls)), - url(r'^tv-schedule-forward/(?P\w+)/$', 'project.redirectors.tv_channel_schedule', name="channel-today"), + url(r'^tv-schedule-forward/(?P\w+)/$', 'project.redirectors.tv_channel_schedule', name="channel-today"), url(r'^tv-episode-forward/(?P\w+)/$', 'project.redirectors.tv_episode_detail', name="episode-detail"), (r'', include(cms.site.urls)) ) From 8c4043488eb521a27558465d8709adba3ee77df5 Mon Sep 17 00:00:00 2001 From: Joey Leingang Date: Thu, 25 Apr 2019 22:40:08 -0400 Subject: [PATCH 2/2] shell runs for python 2.7.15 and django 1.11 --- project/redirectors.py | 8 +++++--- project/urls.py | 21 ++++++++++----------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/project/redirectors.py b/project/redirectors.py index cc9fda5..a8afbe4 100644 --- a/project/redirectors.py +++ b/project/redirectors.py @@ -1,7 +1,9 @@ -from django.http import HttpResponse, HttpResponseRedirect +from django.http import HttpResponseRedirect + def tv_channel_schedule(request, key): return HttpResponseRedirect("http://tv.azpm.org/schedules/%s/" % key) - + + def tv_episode_detail(request, id): - return HttpResponseRedirect("http://tv.azpm.org/schedules/episode/%d/" % int(id)) \ No newline at end of file + return HttpResponseRedirect("http://tv.azpm.org/schedules/episode/%d/" % int(id)) diff --git a/project/urls.py b/project/urls.py index 64ed53d..95eb6e3 100755 --- a/project/urls.py +++ b/project/urls.py @@ -1,15 +1,14 @@ -from django.conf.urls import * +from django.conf.urls import url, include from django.contrib import admin -from libscampi.contrib import cms +from libscampi.contrib.cms.sites import site +from project import redirectors admin.autodiscover() -urlpatterns = patterns( - '', - (r'^comments/', include('django.contrib.comments.urls')), - (r'^admin/doc/', include('django.contrib.admindocs.urls')), - (r'^admin/', include(admin.site.urls)), - url(r'^tv-schedule-forward/(?P\w+)/$', 'project.redirectors.tv_channel_schedule', name="channel-today"), - url(r'^tv-episode-forward/(?P\w+)/$', 'project.redirectors.tv_episode_detail', name="episode-detail"), - (r'', include(cms.site.urls)) -) +urlpatterns = [ + url(r'^admin/doc/', include('django.contrib.admindocs.urls')), + url(r'^admin/', include(admin.site.urls)), + url(r'^tv-schedule-forward/(?P\w+)/$', redirectors.tv_channel_schedule, name="channel-today"), + url(r'^tv-episode-forward/(?P\w+)/$', redirectors.tv_episode_detail, name="episode-detail"), + url(r'', include(site.urls)) +]