redirect old /itf/ urls
This commit is contained in:
parent
06d51e722e
commit
4a3b27b2ac
|
@ -1,7 +1,6 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls.defaults import *
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
||||||
(r'^$', 'festival.views.home'),
|
(r'^$', 'festival.views.home'),
|
||||||
(r'^wireframe', 'festival.views.wireframe'),
|
(r'^wireframe', 'festival.views.wireframe'),
|
||||||
(r'^projects', 'festival.views.projects'),
|
(r'^projects', 'festival.views.projects'),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
from django.shortcuts import render_to_response, get_object_or_404
|
from django.shortcuts import render_to_response, get_object_or_404
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
from festival.models import *
|
from festival.models import *
|
||||||
from bestpractices.models import *
|
from bestpractices.models import *
|
||||||
from utils import validateEmail
|
from utils import validateEmail
|
||||||
|
@ -14,6 +14,38 @@ from django.core.mail import send_mail
|
||||||
from settings import ERANG_SUBSCRIBE_URL
|
from settings import ERANG_SUBSCRIBE_URL
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
|
|
||||||
|
def redirect(request, old_url):
|
||||||
|
REDIRECT_MAPPING = {
|
||||||
|
'people': '/m/itf-core/?tab=people',
|
||||||
|
'meeting': '/m/itf-core/?tab=meetings',
|
||||||
|
'meetings': '/m/itf-core/?tab=meetings',
|
||||||
|
'project': '/m/itf-core/?tab=projects',
|
||||||
|
'projects': '/m/itf-core/?tab=projects',
|
||||||
|
'resources': '/m/bibliography/?tab=documents',
|
||||||
|
'bestpractices/story': '/m/bestpractices/?tab=cases',
|
||||||
|
'erang': '/m/e-rang/?tab=issues'
|
||||||
|
}
|
||||||
|
components = old_url.split("/")
|
||||||
|
if len(components) > 2 and components[0].startswith('bestpractices'):
|
||||||
|
part_one = "/".join(components[:-1])
|
||||||
|
else:
|
||||||
|
part_one = components[0]
|
||||||
|
if part_one in REDIRECT_MAPPING.keys():
|
||||||
|
url = REDIRECT_MAPPING[part_one]
|
||||||
|
if len(components) > 1:
|
||||||
|
no = components[-1]
|
||||||
|
try:
|
||||||
|
object_id = int(no)
|
||||||
|
if object_id > 0:
|
||||||
|
url += "&object_id=%d" % object_id
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
url = "/"
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
index_data = {}
|
index_data = {}
|
||||||
new_meetings = MeetingDay.objects.all().order_by('-meeting_date')[:5] # get 5 latest meetings
|
new_meetings = MeetingDay.objects.all().order_by('-meeting_date')[:5] # get 5 latest meetings
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<link rel="stylesheet" href="/static/css/noel/inner.css" type="text/css" />
|
<link rel="stylesheet" href="/static/css/noel/inner.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="/static/css/noel/inner-details.css" type="text/css" />
|
<link rel="stylesheet" href="/static/css/noel/inner-details.css" type="text/css" />
|
||||||
<link type="text/css" rel="stylesheet" href="/static/css/jquery.tooltip.css" />
|
<link type="text/css" rel="stylesheet" href="/static/css/jquery.tooltip.css" />
|
||||||
<link rel="canonical" href="{{ item.get_absolute_url }}" />
|
<link rel="canonical" href="http://theatreforum.in{{ item.get_absolute_url }}" />
|
||||||
<!--
|
<!--
|
||||||
<script type="text/javascript" src="/static/js/history/history.js"></script>
|
<script type="text/javascript" src="/static/js/history/history.js"></script>
|
||||||
<script type="text/javascript" src="/static/js/history/amplify.store.js"></script>
|
<script type="text/javascript" src="/static/js/history/amplify.store.js"></script>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<p>
|
<p>
|
||||||
<a href="{{ result.object.get_absolute_url }}&search={{ query }}">{{ result.object.title }}</a> <br />
|
<a href="{{ result.object.get_absolute_url }}&search={{ query }}">{{ result.object.title }}</a> <br />
|
||||||
{{ result.text|truncatewords:60|markdown|safe }}
|
{{ result.text|truncatewords:60|markdown|safe }}
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<p class="noResults">No results found.</p>
|
<p class="noResults">No results found.</p>
|
||||||
|
|
|
@ -31,7 +31,7 @@ urlpatterns = patterns('',
|
||||||
# (r'api/', 'api.views.api'),
|
# (r'api/', 'api.views.api'),
|
||||||
# (r'jsdoc/', 'api.views.jsdoc'),
|
# (r'jsdoc/', 'api.views.jsdoc'),
|
||||||
# (r'site.json', 'app.views.site_json'),
|
# (r'site.json', 'app.views.site_json'),
|
||||||
(r'^itf/', include('festival.urls')),
|
(r'^itf/(?P<old_url>.*)', 'festival.views.redirect'),
|
||||||
# (r'^accounts/register/', 'registration.views.register', {'form_class': ItfRegistrationForm }),
|
# (r'^accounts/register/', 'registration.views.register', {'form_class': ItfRegistrationForm }),
|
||||||
(r'^accounts/', include('registration.urls')),
|
(r'^accounts/', include('registration.urls')),
|
||||||
(r'^admin/', include(admin.site.urls)),
|
(r'^admin/', include(admin.site.urls)),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user