CoolFace
Apppublic

SRNI-2005/ctf

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
fields.py18 linesDownload Raw Back to forms
1from wtforms import SubmitField as _SubmitField2 3 4class SubmitField(_SubmitField):5    """6    This custom SubmitField exists because wtforms is dumb.7 8    See https://github.com/wtforms/wtforms/issues/205, https://github.com/wtforms/wtforms/issues/369    The .submit() handler in JS will break if the form has an input with the name or id of "submit" so submit fields need to be changed.10    """11 12    def __init__(self, *args, **kwargs):13        name = kwargs.pop("name", "_submit")14        super().__init__(*args, **kwargs)15        if self.name == "submit" or name:16            self.id = name17            self.name = name18