The Flask wtforms subclass uses constructors to keep reporting errors and asking for help.

when writing web programs using the Flask web framework, the form class selects flask_wtf.
inherits FlaskForm when creating a class, and writes constructs in subclasses that always report errors. I don"t know why?

from flask_wtf import FlaskForm

class Auth(FlaskForm):
    
    def __init__(self, *args, **kwargs):
        super(Auth, self).__init__(*args, **kwargs)


"""  """
from . import forms

@auth.route("/")
def index():
    s = forms.Auth()
    return render_template("auth/index.html")

clipboard.png

Apr.15,2021

the object must be created in advance in the class property and the value of the property must be set in the constructor.

from flask_wtf import FlaskForm
class Auth(FlaskForm):
 
    selects = SelectField('selects')
    
    def __init__(self):
        super(Auth, self).__init__()
        self.selects.choices = [('value', 'text'), ('value', 'text')]

my project https://github.com/eastossifr. uses flask-wtf,. I suggest you have a look when you are free. I am often online. If you don't understand, you can ask me directly.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b400c7-4f147.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b400c7-4f147.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?