Questions tagged [flask-wtforms]
Flask-WTF offers simple integration with WTForms. This integration includes optional CSRF handling for greater security.
2,239
questions
0
votes
0
answers
6
views
With Flask-wtf and flask-sqlqlchemy - should I use QuerySelectField vs SelectField with dynamic choices populated in init?
I'm creating a Flask app and specifically using flask-wtf and flask-sqlalchemy.
As I am still new to this I've tried both QuerySelectField for dynamic Select fields, and using SelectField with the ...
0
votes
0
answers
12
views
How to update DB record in Flask with SQLAlchemy using WTForms SelectMultipleField
I am deploying a SelectMultipleField in order for the user to select containers to move to a different booking.
The problem is that everytime I submit the button, I go to the index page and check the ...
-2
votes
0
answers
19
views
Flask: use authentication cookies to send post request
I developed an UI and an API with Python Flask.
When the user is authenticated over the UI, I want to give him the ability to send request to the API without specifying his password.
To authentication ...
-2
votes
1
answer
21
views
How to access the image using path in Flask? [duplicate]
I have to use an image that is stored in the directory uploaded/images in Html/javascript file using Flask.
<img id="img" src= "">
<h1 id="file_path" style=&...
0
votes
1
answer
21
views
Custom Flask Validation Error not triggering getting Unique constraint error instead
I have created a registration form with validation but instead of this error Unique Constraint error is coming how can I fix this
Below is the register class
class Registerform(FlaskForm):
...
0
votes
0
answers
16
views
FlaskForm with dynamically labelled StringField using dictionary
A simple flask form with a StringField looks like:
class SomeFormName(FlaskForm):
value = StringField(label='Enter Value Here: ')
As an output from another function I have a dictionary that ...
1
vote
1
answer
65
views
AttributeError: 'MultiDict' object has no attribute 'iteritems' when moving from localhost to heroku
I am getting the following error. When running on localhost all works fine.
2022-08-13T14:17:31.683406+00:00 app[web.1]: [2022-08-13 14:17:31,682] ERROR in app: Exception on /create [GET]
2022-08-...
1
vote
1
answer
20
views
FlaskWTF csrf exempt not working...throws The CSRF token is missing exception
I am setting up a stripe webhook that sends a post request to an endpoint on successful transaction.
My flask route is setup as below:
@app.route("/success", methods=["POST"])
@...
0
votes
2
answers
36
views
Flask Wtforms FieldList(FormField to populate a SelectField with choices is not appending to form
I am trying to populate a form using a combination of str and lists. The string fields in the form populate without issue. However the selectfield in the form appears to only display the last entry ...
0
votes
1
answer
23
views
Upon submission form is not validated
I am trying to implement a form that collects data on a concert venue and stores it on my local postgres database using wtforms and flask-sqlalchemy orm.
I have noticed that my form fails to validate ...
0
votes
0
answers
20
views
how to get text from a dynamic table in wtforms
I want to create a flask form where data is dynamically added.
I have this table where its columns are inputs, and the last one is an 'add' button which adds the inputs into a new row. And I have to ...
0
votes
0
answers
15
views
Is it possible to make a Flask WTForms TextAreaField horizontally expandable
Here's my code
class TestForm(FlaskForm):
textarea = TextAreaField("test", validators=[DataRequired()], widget=TextArea())
submit = SubmitField('submit')
<p>
{{ form....
0
votes
1
answer
44
views
Flask-login causing login form to not validate
The login form of my flask app is failing to validate (form.valididate = false) when the app has automatically logged users out:
app.permanent_session_lifetime = timedelta(minutes=5)
form.errors ...
0
votes
1
answer
21
views
Validating based on two different form data with WTF
I am trying to take two different input job,income and validate both before submit. Like if job is "Office" income must be in range of (55000,13000) it has 3 more condition like this. I have ...
0
votes
1
answer
28
views
Why is wtforms SelectMultipleField returning no selected values?
I am trying to use the flask (2.1.3) wtforms (3.0.1) SelectMultipleField() type. It renders just fine. I can select multiple values but none of them are in the form result after submission.
My form ...
0
votes
1
answer
31
views
Bootstrap 5 Form Floating Labels are always in the upper position when using flask-wtforms
I am using flask, jinja, and wtforms to make an account creation page, and am using bootstrap's floating labels. My issue is that the labels start in the upper "floating" position on page ...
0
votes
1
answer
30
views
wtform EqualTo does't validate
I'm trying to validate a form using EqualTo validator but even if I test with different inputs the form does't throw any error.
this is the code of route:
@app.route("/register", methods=[&...
0
votes
1
answer
32
views
What is the best way to create a dynamic selection list from database column with Python and Flask WFForms?
Spent several hours today trying to get the unique values in my database into a dropdown selection with Flask WTForms.
The Database is MySQL, and I'm actually using SQLAlchemy for the majority of this ...
-1
votes
1
answer
29
views
how does a flask server validates the form even after returning the html file itself?
@app.route("/register", methods=["GET", "POST"])
def register():
form = Form()
if form.validate_on_submit():
pass
return render_template("...
-1
votes
1
answer
54
views
I am trying to create a database with flask_sqlalchemy in python and it not showing up
Hi all I am trying to make a database in python using flask and flask_sqlalchemy there is no error when I run the code but there is no database been created as far as I can see, i am sure it is just ...
0
votes
0
answers
17
views
Autocomplete js returning TypeError: t is not a function
I am building a web app using flask and mongodb. I have a search page which I am trying to implement autocomplete for from mongodb. I have a flask route which returns data from the autocomplete ...
0
votes
0
answers
32
views
Why does my website flash "All Forms Required" and not fill the database even though I filled out all forms?
I have been having this problem where I submit a form and it gives me the error message all forms required. I already submitted the forms though. This is the error message.
Error Message. This is ...
0
votes
0
answers
22
views
Send Data from FlaskApi to WtForm(Similar to receiving response and Using it in Angular)
I'm new to Flask and WTForms. I was trying to create a calculator app, with only two input fields and return the Sum and display it below the same form. But I'm not sure on how to use the response ...
0
votes
0
answers
42
views
View, edit and update multiple db rows at once using Flask WTForms
I have been dabbling in some flask and flask WTForms this weekend to make a DYI meal planner and on the whole there has been great guides online. What I have managed to do is set up a flask webapp ...
-1
votes
1
answer
57
views
AttributeError: 'Request' object has no attribute 'post'
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 ...
0
votes
0
answers
34
views
How to add form fields in flask on button press?
I'm trying to make a form, where one of the fields is a FormField. I need to be able to add fields on button press. I was thinking maybe it would be possible to simply increase the number of ...
-1
votes
0
answers
37
views
How can I use CSS to design Jinja templates?
I know how to link a template to a css file (You will see that in the code below).
What I want to ask is how I can add CSS to variables in a Jinja template.
This is the route info for the template:
@...
0
votes
0
answers
28
views
Flask form does not validate or return (display) errors
The form does not show any errors when i try to submit it, it just reload the sign up page even though there are errors in my input, i used an if statement to see there are errors and the for loop to ...
1
vote
1
answer
31
views
Set file limit when uploading multiple files flask wtforms
I was wondering how to set a validation method which limits the size of each file when using the flask wtform MultipleFileField before then being able to save the file.
There was a useful post here, ...
0
votes
1
answer
44
views
Filtering with python for searching in database
Iam new to python and iam coding a small webapp to search in a database.
I have tried this code but it doesnt work. It only work when put a max of 3 colum to search like lieu, cote , categorie for ...
0
votes
2
answers
30
views
Flask-WTF not validating with FieldList subforms
I am trying to get a test form that includes subforms to work but the form does not validate on submission. The form itself is submitting a recipe with ingredients as its subforms using FieldList(). I ...
0
votes
1
answer
24
views
Creating hidden section in Flask, WTForms
I have a form using Flask and WTForms, the form has few required fields but a long list of optional fields. My problem is that I don’t want the page to be really long when the majority of users will ...
-1
votes
1
answer
24
views
Input multiple objects of a class in a single HTML or Flask form
For the sake of simplicity, say I want to build a shopping list using Flask using a table in a format that looks like this:
Name
Cost
Amount
Sell-By
Apples
1
5
2022-07-18
Bananas
0.7
7
2022-07-20
...
0
votes
2
answers
57
views
Exact match with filter() Flask
I'am new to python and iam coding a small webapp to search in a database. Its fonctionnal but doesnt function well.
Example : If i search for a 'lieu', a 'Annee' and a 'Signataire' it doesnt give me ...
0
votes
1
answer
21
views
jinja2.exceptions.UndefinedError: 'form' is undefined in Flask-security
I write a site on Flask, I connected flask-security, at first I changed the authorization template to the standard flask-security authorization template, I found a way to solve this problem, but now, ...
0
votes
1
answer
38
views
How to write data to .sqlite3 from SelectMultipleField (Flask), many to many relation, SQLAlchemy
I can add to database only title and content fields. But when it comes to adding categories from SelectMultipleField, it goes wrong. Now submit button of form (named 'Add') doesn't work when I select ...
0
votes
0
answers
19
views
Flask admin edit form have wrong relation selected
I have a model with multiple relations to other objects.
When opening an edit form, the different list-boxes have the right relation already selected (corresponding the the edited object values), but ...
0
votes
0
answers
21
views
TypeError: 'MultiCheckboxField' object is not subscriptable
TypeError: 'MultiCheckboxField' object is not subscriptable
Hi,
I'm trying to develop a flask form that will write to excel. The function I'm trying to achieve is to write a new row for each size.
I ...
0
votes
0
answers
36
views
How to change the width and text-align of a wtf-form's quick_form "StringField" input tag at the same time?
I want to both change the width and the text-align of an input tag (StringField) of a form (a Flask wtforms wtf.quick_form). From a similar question (Can you adjust the width of a question in flask-...
0
votes
0
answers
17
views
Form fields not displaying when creating a simple form with mongoengine-flask with wtf forms
I'm trying to get just a basic model and form to show up with mongoengine and WTF forms, and following the basic instructions from the website aren't working for me. I'm sure it's something simple ...
0
votes
1
answer
69
views
Single FlaskForm rendered multiple times on one page using FOR loop
I'm making an application where I need to render identical forms multiple times on one page (number of forms might be from 1 to 20). In the video below I'm using simple for loop over a range from 0 to ...
0
votes
0
answers
49
views
Why does `display:none` on a textbox break a button action (using Flask-WTForm)?
Overall objective:
I am using Flask-WTF in a page that will create tables in a database, with the ability to create a variable number of columns by dynamically adding fields via js. It also adds info ...
0
votes
1
answer
67
views
Turbo-flask turbo.push when button is submitted
I am using WTForms and turbo-flask
I have a template which I want to change
<div>
{% if data is defined %}
{% for item in data %}
<div id="load" class="col-12 col-sm-6 offset-...
0
votes
0
answers
21
views
I need to find a way to import a FlaskForm in vueJS
In this I have created a flask login portal using flask-login and wtforms.
But my project requires me to develop the frontend using vueJS and not just rendering HTML. Unfortunately, I am unable to ...
0
votes
1
answer
35
views
wtforms import could not be resolved
I am trying to import wtforms, flask_wtf, and others into my flask app. All other solutions are saying to make sure it is installed in the right place. When I do "py -m pip show flask_wtf, py -m ...
0
votes
0
answers
23
views
Flask server crashes after form submit using js-npm-based form field (crbug/1173575 non-JS module files deprecated)
In my current project I try to implement a datepicker. So far it works, but as I want to submit the form with my custom datepicker, my application breaks and flask is turned off with just crbug/...
0
votes
0
answers
22
views
WTForms IntegerField doesn't work properly with NumberRange as validator
I have a problem with a validator. When I'm trying to submit a form with a IntegerField 0 doesn't work,flask yelling This field is requiered.
The form:
class Update_vars(FlaskForm):
start_date = ...
0
votes
1
answer
30
views
Fields are not populated on update
I created a simple CRUD app using Flask and FlaskForm. I have a table where the last name, first name, birthdate, and sex are displayed coming from the database. Beside each name are links labeled as ...
0
votes
1
answer
44
views
Flask-WTF form with a variable number of fields (a list of items)
I've a form to create a cocktail recipe. It has some common fields like name, description and others, and also a list of ingredients. An ingredient has an ID (foreign-key for a table of ingredients), ...
0
votes
2
answers
35
views
Trying to compare 3 wtforms fields with custom functions and geting recursion problem
I have 3 fields that I want to compare salary "from" field and "to" field and also there is fixed salary field. I have no idea how to do it, since there is no documentation how to ...