From 036f66784a787db01a208f2da11f97f0b4cb200d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Fuayip=20=C3=BCz=C3=BClmez?= Date: Thu, 7 Mar 2024 00:27:19 +0300 Subject: [PATCH] Improve integration with Django Debug Toolbar --- rest_framework/static/rest_framework/js/ajax-form.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rest_framework/static/rest_framework/js/ajax-form.js b/rest_framework/static/rest_framework/js/ajax-form.js index 1483305ff..dda5454c2 100644 --- a/rest_framework/static/rest_framework/js/ajax-form.js +++ b/rest_framework/static/rest_framework/js/ajax-form.js @@ -3,6 +3,12 @@ function replaceDocument(docString) { doc.write(docString); doc.close(); + + if (window.djdt) { + // If Django Debug Toolbar is available, reinitialize it so that + // it can show updated panels from new `docString`. + window.addEventListener("load", djdt.init); + } } function doAjaxSubmit(e) {