changed the handler404 and handler500 to a custom view, passing scope to get proper formed urls when displaying 404 and 500 pages 2011
authorParth buch <parth.buch.115@gmail.com>
Sat, 01 Oct 2011 03:59:03 +0530
branch2011
changeset 429 cde70fd3073c
parent 428 d7fefdb4b947
child 430 54375874dac1
changed the handler404 and handler500 to a custom view, passing scope to get proper formed urls when displaying 404 and 500 pages
project/scipycon/views.py
project/urls.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project/scipycon/views.py	Sat Oct 01 03:59:03 2011 +0530
@@ -0,0 +1,22 @@
+from django.shortcuts import render_to_response
+from django.template import RequestContext
+from django.conf import settings
+
+
+def handler404(request, template_name='404.html'):
+    """
+    Loads 404 page while passing scope
+    """
+    scope = settings.CURRENT_SCOPE
+    return render_to_response(template_name, RequestContext(request, {
+        'params': {'scope': scope},
+    }))
+
+def handler500(request, template_name='500.html'):
+    """
+    Loads 500 page while passing scope
+    """
+    scope = settings.CURRENT_SCOPE
+    return render_to_response(template_name, RequestContext(request, {
+        'params': {'scope': scope},
+    }))
--- a/project/urls.py	Sat Oct 01 03:57:37 2011 +0530
+++ b/project/urls.py	Sat Oct 01 03:59:03 2011 +0530
@@ -166,7 +166,8 @@
      url(r'^password-reset-complete/$', 'password_reset_complete'),
 )
 
-handler404 = 'django.views.defaults.page_not_found'
+handler404 = 'project.scipycon.views.handler404'
+handler500 = 'project.scipycon.views.handler404'
 
 # Serve static files in DEBUG = True mode
 if settings.DEBUG: