Answer the question
In order to leave comments, you need to log in
How to write custom error pages in django admin?
The admin panel is connected to the django project.
In the case when an error appears in the admin panel, instead of the standard template with an error implemented for the entire site ('500.html'), you need to issue a template that is implemented for the admin panel itself ('admin/500.html').
Answer the question
In order to leave comments, you need to log in
Did it like this:
#admin/views.py
from django.shortcuts import render_to_response
...
def handler500(request, *args, **kwargs):
response = render_to_response('admin/500.html')
response.status_code = 500
return response
def handler404(request, *args, **kwargs):
response = render_to_response('admin/404.html')
response.status_code = 404
return response
...
#admin/urls.py
...
handler404 = 'admin.views.handler404'
handler500 = 'admin.views.handler500'
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question