app.py
from flask import Flask, render_template
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, FieldList, FormField
app = Fla
It's not the ideal solution, but this works though.
from flask import Flask, render_template
from flask_wtf import FlaskForm, Form
from wtforms import StringField, SubmitField, FieldList, FormField
app = Flask(__name__)
app.config['SECRET_KEY'] = 'apple pie'
class BookForm(FlaskForm):
book = StringField('book title')
class LibraryForm(FlaskForm):
library = StringField('Library name')
books = FieldList(FormField(BookForm))
submit = SubmitField('Submit')
@app.route('/book', methods=['GET', 'POST'])
def book():
form = LibraryForm()
if form.validate_on_submit():
return 'aww yeah'
for i in range(6):
form.books.append_entry()
return render_template('books.html', form = form)