Detect Django's debug mode and render the server side error page properly.

Signed-off-by: Eric Riggs <ericriggs42@gmail.com>
This commit is contained in:
Eric Riggs
2018-04-01 20:37:42 -04:00
committed by Roberto Rosario
parent d2eef74bb8
commit 0fbfb17d83
2 changed files with 10 additions and 6 deletions
@@ -143,12 +143,15 @@ PartialNavigation.prototype.processAjaxRequestError = function (jqXHR) {
* user.
*/
if (jqXHR.status == 0) {
$('#modal-server-error .modal-body').html($('#template-error').html());
$('#modal-server-error').modal('show')
if (djangoDEBUG) {
$('#ajax-content').html('<pre class="text-primary" style="background-color:#ffe7ae"><code>' + jqXHR.responseText + '</code></pre>');
} else {
$('#ajax-content').html(jqXHR.responseText);
}
if (jqXHR.status == 0) {
$('#modal-server-error .modal-body').html($('#template-error').html());
$('#modal-server-error').modal('show')
} else {
$('#ajax-content').html(jqXHR.responseText);
}
}
PartialNavigation.prototype.setLocation = function (newLocation, pushState) {