Fixes #1767: Use proper template for 404 responses

This commit is contained in:
Jeremy Stretch 2017-12-13 11:49:36 -05:00
parent 3dc4e1dc0a
commit deb148fdf7

View File

@ -4,7 +4,7 @@ import sys
from django.conf import settings from django.conf import settings
from django.db import ProgrammingError from django.db import ProgrammingError
from django.http import HttpResponseRedirect from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render from django.shortcuts import render
from django.urls import reverse from django.urls import reverse
@ -61,6 +61,10 @@ class ExceptionHandlingMiddleware(object):
if settings.DEBUG: if settings.DEBUG:
return return
# Ignore Http404s (defer to Django's built-in 404 handling)
if isinstance(exception, Http404):
return
# Determine the type of exception # Determine the type of exception
if isinstance(exception, ProgrammingError): if isinstance(exception, ProgrammingError):
template_name = 'exceptions/programming_error.html' template_name = 'exceptions/programming_error.html'