1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #1767: Use proper template for 404 responses

This commit is contained in:
Jeremy Stretch
2017-12-13 11:49:36 -05:00
parent be6ef15ffa
commit a9af75bbd1

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'