Здравствуйте, мне нужна небольшая помощь, пожалуйста, у меня нет данных, отображаемых в таблице. У меня есть данные, которые отправляются из модальной формы бутстрапа в базу данных sqlite3.Данные не отображаются в таблице загрузочных файлов с использованием фляжки
Любая помощь будет отличной.
Вот вид
@dashboard.route('/stream/products', methods=['GET', 'POST'])
@login_required
def products():
product = Product()
form = ProductForm(product=product)
if current_user.can(Permission.WRITE_PRODUCTS) and \
form.validate_on_submit():
filename = secure_filename(form.image.data.filename)
form.image.data.save('./app/static/uploads/' + filename)
product.name=form.name.data
product.description=form.description.data
product.part=form.part.data
product.price=form.price.data
product.manager=current_user._get_current_object()
db.session.add(product)
flash('The product has been updated.')
return redirect(url_for('.products',name=product.name))
form.name.data=product.name
form.description.data=product.description
form.part.data=product.part
form.price.data=product.price
products = Product.query.order_by(Product.name.desc()).all()
else:
filename = None
return render_template('dashboard/content/products.html',form=form, filename=filename, product=product)
вот HTML я не могу показаться, чтобы найти то, что недостающее звено.
<tbody>
{% for product in products %}
<tr>
<td>{{ product.id }}</td>
<td colspan="1">{{ product.image(class="img-responsive") }}</td>
<td colspan="3">{{ product.name }}</td>
<td colspan="1">{{ product.part }}</td>
<td colspan="2">{{ product.price }}</td>
<td colspan="1"><button type="button">Edit</button></td>
<td colspan="1"><button type="button" >Delete</button></td>
<td colspan="1"><input type="checkbox"></td>
</tr>
{% endfor %}
</tbody>
Модель такова.
class Product(db.Model):
__tablename__ = 'products'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(55))
description = db.Column(db.Text)
part = db.Column(db.String(55))
price = db.Column(db.Integer)
manager_id = db.Column(db.Integer, db.ForeignKey('users.id'))