1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[4.1.x] Fixed #33893 -- Reverted "Fixed #28889 -- Prevented double submission of admin forms."

Regression in fe7dbef586.

Backport of 0756c61f2a from main
This commit is contained in:
Fab
2022-08-05 08:27:20 +01:00
committed by Mariusz Felisiak
parent 7b0ed458d9
commit 82e9e19ebe
4 changed files with 43 additions and 119 deletions

View File

@@ -1,23 +1,9 @@
/*global gettext*/
'use strict';
{
const inputTags = ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'];
const modelName = document.getElementById('django-admin-form-add-constants').dataset.modelName;
let submitted = false;
if (modelName) {
const form = document.getElementById(modelName + '_form');
form.addEventListener('submit', (event) => {
event.preventDefault();
if (submitted) {
const answer = window.confirm(gettext('You have already submitted this form. Are you sure you want to submit it again?'));
if (!answer) {return;}
};
event.target.submit();
submitted = true;
});
for (const element of form.elements) {
// HTMLElement.offsetParent returns null when the element is not
// rendered.