wtforms Questions
2
Solved
Flask-WTF's documentation states that:
Flask-WTF provides you a FileField to handle file uploading, it will automatically draw data from flask.request.files if the form is posted. The data attri...
Haematoid asked 5/10, 2013 at 22:23
8
Solved
For the life of me, I can't figure out how to pre-populate a BooleanField with WTForms. I have a field called "active". It defaults to being not checked, and it's not required. So I set it up like....
3
Solved
My UploadForm class:
from app import app
from flask_wtf.file import FileRequired, FileAllowed
from wtforms.fields import MultipleFileField
from wtforms.validators import InputRequired,DataRequi...
Oops asked 14/1, 2020 at 12:59
4
Solved
I'm want to populate a WTForms SelectField with the rows returned by this query:
cur.execute("SELECT length FROM skipakke_alpin_ski WHERE stock > 0")
The query returns rows with the ski lengt...
3
I have a custom field inside a FormField inside a FieldList: locations
class LocationForm(Form):
id = HiddenField('id')
title = StringField(_l('Title'), [Required()])
location = CoordinatesFiel...
2
Solved
I've been curious lately what the benefits of using WTForms to submit data to flask is? Plain HTML, JavaScript, or bootstrap form seem easier to style and easier to submit with. Plus you can leave ...
2
Solved
I am creating a form using Flask-WTForms.
I am using a BooleanField so that a user can indicate they agree terms.
I cannot validate the BooleanField upon submission to ensure that it has been che...
Au asked 15/7, 2016 at 18:25
3
Solved
I want a submit button that displays an icon rather than text. The button is a field in a WTForms form. I am using Bootstrap and Open Iconic for styling and icons. How do I set the submit field to ...
2
Solved
WTForms was updated to 2.3.0 with a breaking change. I have tried adjusting other requirements such as werkzeug.1.0.0 but no luck yet. Has anyone found a solution?
Here is the stack strace:
Trace...
Pegpega asked 22/4, 2020 at 11:17
4
Solved
I want to add a placeholder attribute on to the field in WTForms. How can I do it?
abc = TextField('abc', validators=[Required(), Length(min=3, max=30)], placeholder="test")
The above code is no...
4
Solved
What I'm asking for is actually quite simple. I want to create a form with some fields and a submit and a cancel button. I want to use the quick_form template function of Flask-Bootstrap to keep ov...
Autonomic asked 23/12, 2016 at 11:30
2
I have a Flask App that passes user input validation when it should fail. I have similar code in another part of the app that works just fine. It seems like the FileAllowed() method is not being ca...
Indoaryan asked 14/2, 2019 at 23:5
3
I my current project, my index page show several torrents with a button for each to start or stop the torrent.
I create the page with a form and a loop, so the forms have always the same names. Bu...
Ezarra asked 28/9, 2013 at 14:11
7
Solved
I have the following code:
class Company(enum.Enum):
EnterMedia = 'EnterMedia'
WhalesMedia = 'WhalesMedia'
@classmethod
def choices(cls):
return [(choice.name, choice.name) for choice in cls]...
3
Solved
If I set the default value during construction of the field, all works as expected:
my_field = StringField("My Field: ", default="default value", validators=[Optional(), Length(0, 255)])
However...
Ornelas asked 29/7, 2018 at 3:22
4
I'm trying to implement Select2 field in one of my flask views. Basically I want the same select2 field in my flask application view (not a flask admin modelview) as in Flask-admin model create vie...
Sociology asked 31/10, 2014 at 22:0
2
Solved
I have a SQLAlchemy model with an integer column being populated from an HTML form (I'm using Flask and WTForms-alchemy and I'm trying to avoid writing custom code in routes). If the user does not ...
Papule asked 31/7, 2019 at 13:17
1
I just started coding with Flask and I want to set up CSRF on a small form in my application. I am following this https://wtforms.readthedocs.io/en/stable/csrf.html for session based implementation...
Zambia asked 7/4, 2015 at 21:35
2
Solved
I read through Flask-WTF extremely simplified wiki, and couldn't understand much about what I can do with it. I am under the impression that the <form> section of the html now can only look l...
Deplorable asked 12/1, 2016 at 8:2
2
Solved
I'm not quite sure how approach this matter. I hope i get there.
For example I have a table full of addresses on a page. The count of these are dynamic (could be 5 or 10 or any other count). And I...
Fescennine asked 6/2, 2015 at 22:2
3
I have this order form that allows my users to create an order. An order consists of multiple tuples of (producetype, quantity). Producetype should be rendered in a <select> form while quanti...
Drapery asked 19/6, 2014 at 0:3
3
class Form(Form):
plan_start = DateField('Plan Start', validators=[Required()])
this code will render this html.
<input id="plan_start" name="plan_start" type="text" value="">
My quest...
1
Solved
In my flask app I have a WTForm with two date pickers for a 'start date' and an 'end date'. What is the best way to validate that the 'end date' is not earlier than the 'start date'?
from flask_wt...
4
Solved
I have some fields in page disabled as for example:(using jinja2 templating system)
<html>
<body>
<form action="" method=POST>
{{ form.name(disabled=True) }}
{{ form.title }}
...
4
Solved
To render my textareafield with a specified number of columns and rows with WTForms, how do I set the number of columns and rows? I followed the instructions from this question but it didn't work:
...
© 2022 - 2024 — McMap. All rights reserved.