flask-wtforms

getting Import "flask_wtf" could not be resolved

getting Import "flask_wtf" could not be resolved Question: I am getting ‘Import "flask_wtf" could not be resolved’. I had the same problem with: from flask import Fask I Had to reinstall flask multiple times for flask_wtf I am getting Requirement already satisfied: itsdangerous in c:usersmyprojectvenvvenvlibsite-packages … Installing collected packages: WTForms, flask-wtf Successfully installed WTForms-3.0.1 flask-wtf-1.1.1 …

Total answers: 1

SQLAlchemy column passed as dropdown list in WTForm Flask

SQLAlchemy column passed as dropdown list in WTForm Flask Question: I want to take the values of a column named hotelName from Hotel model and populate with them a dropdown list. I have tried this as a way to put them in my wtform: class RoomForm(FlaskForm): hotel = SelectField(choices=[(h, h) for h in Hotel.hotelName.property.columns[0].type But …

Total answers: 1

Error when submitting flask-wtf into database

Error when submitting flask-wtf into database Question: I am quite new to flask and I ran into a dead-end. I try to make a reservation form and save it into my database, but something is not working well. Here is the form: class ReservationForm(FlaskForm): checkIn = DateField(‘Start Date’, format=’%Y-%m-%d’, validators=(validators.DataRequired(),)) checkOut = DateField(‘End Date’, format=’%Y-%m-%d’, …

Total answers: 2

Flask WTForms how to prevent duplicate form submission

Flask WTForms how to prevent duplicate form submission Question: I’m new to Flask. Forms.py: class NoteForm(FlaskForm): note = fields.TextAreaField("Note") add_note = fields.SubmitField("Add Note") router.py: add_note_form = forms.NoteForm() template: <div class="form-group"> {{ add_note_form.add_note}} </div> Now if I click the add note button multiple times in a very short time ,the form will be summitted for multiple …

Total answers: 1

Can anyone pls help me how to resolve this issue?

Can anyone pls help me how to resolve this issue? Question: AttributeError “ classes.py file from flask_wtf import Form from wtforms import TextField, IntegerField, SubmitField class CreateTask(Form): title = TextField(‘Task Title’) shortdesc = TextField(‘Short Description’) priority = IntegerField(‘Priority’) create = SubmitField(‘Create’) class DeleteTask(Form): key = TextField(‘Task Key’) title = TextField(‘Task Title’) delete = SubmitField(‘Delete’) class …

Total answers: 1

jinja2.exceptions.UndefinedError: 'forms.SignupForm object' has no attribute 'hidden_tag'

jinja2.exceptions.UndefinedError: 'forms.SignupForm object' has no attribute 'hidden_tag' Question: This code used to work and has since become deprecated. It is now giving an error" "jinja2.exceptions.UndefinedError: ‘forms.SignupForm object’ has no attribute ‘hidden_tag’". I have been researching and can’t seem to identify what has changed. Can anyone help? **forms.py** from flask_wtf import Form from wtforms import StringField, …

Total answers: 1

How can I add a value to a WTForms Submit field without changing its display label?

How can I add a value to a WTForms Submit field without changing its display label? Question: When I set a value for the field it changes the display label of the field. I’m using FlaskWTForms and the field is defined as: class EditMultilpeChoiceQuestion(FlaskForm): submit_update = SubmitField(name="submit_update", label="Update question") In the Jinja template the code …

Total answers: 1

How to configure __init__ in FlaskForm to have same functionalities?

How to configure __init__ in FlaskForm to have same functionalities? Question: So I want to pass a variable to a flask form, in order to do it I’ve decided to modify the __init__ of SongForm, but when I do it the album field loses its properties in the html. Does anyone know how do i …

Total answers: 1

AttributeError: 'Request' object has no attribute 'post'

AttributeError: 'Request' object has no attribute 'post' Question: I have been working on implementing WTForms Dynamic Fields. Linked: https://pypi.org/project/WTForms-Dynamic-Fields/ I am getting the error: AttributeError: ‘Request’ object has no attribute ‘post’ I understand I am doing something wrong, but I am not entirely sure what, exactly. My code is: @app.route("/create", methods=["POST", "GET"]) @login_required def create(): …

Total answers: 1