0

I was trying to display data tables from my db on same page like from one table only one row from another table all the rows and is displaying the data from first table but from second table is not is not displaying the data only blank.

In next example there are 3 rows in the table on db but they are displaying like this only the template 3 times but without data.

What shall I check to fix or what causes this issue.

enter image description here

The SQL command created is this one for the one is picture attached:

2018-03-28 12:03:34,948 INFO sqlalchemy.engine.base.Engine (1,)
2018-03-28 12:03:34,954 INFO sqlalchemy.engine.base.Engine SELECT cm13.id AS cm13_id, cm13.cm_visf AS cm13_cm_visf, cm13.cm_vist AS cm13_cm_vist, cm13.cm_vib AS cm13_cm_vib, cm13.cm_vion AS cm13_cm_vion, cm13.cm_vexp AS cm13_cm_vexp, cm13.date_posted AS cm13_date_posted, cm13.user_id AS cm13_user_id 
FROM cm13

The SQL command for the one what is displaying data not only the templates is this one:

2018-03-28 12:03:34,955 INFO sqlalchemy.engine.base.Engine ()
2018-03-28 12:03:34,963 INFO sqlalchemy.engine.base.Engine SELECT cm14.id AS cm14_id, cm14.cm_mc AS cm14_cm_mc, cm14.cm_mcon AS cm14_cm_mcon, cm14.cm_mcdr AS cm14_cm_mcdr, cm14.cm_mcd AS cm14_cm_mcd, cm14.cm_mcexp AS cm14_cm_mcexp, cm14.date_posted AS cm14_date_posted, cm14.user_id AS cm14_user_id 
FROM cm14 
WHERE cm14.id = ?

Is it the issue related to in cm13 ex is not appearing in sql command the "WHERE cm13.id = ?"

Because for cm13 I am using "ictcm13 = cm13.query.all()" and for cm14 I am using "ctcm14 = cm14.query.filter_by(id=user_id).one_or_none()"

I was trying even in separate page without query, filter_by and still not working only is displaying the templates exactly how many rows are in the table but no data is displaying at all, and this the SQL Command without errors:

2018-03-28 14:30:49,155 INFO sqlalchemy.engine.base.Engine SELECT cm13.id AS cm13_id, cm13.cm_visf AS cm13_cm_visf, cm13.cm_vist AS cm13_cm_vist, cm13.cm_vib AS cm13_cm_vib, cm13.cm_vion AS cm13_cm_vion, cm13.cm_vexp AS cm13_cm_vexp, cm13.date_posted AS cm13_date_posted, cm13.user_id AS cm13_user_id 
FROM cm13 ORDER BY cm13.date_posted DESC
2018-03-28 14:30:49,156 INFO sqlalchemy.engine.base.Engine ()
2018-03-28 14:30:49,174 INFO sqlalchemy.engine.base.Engine ROLLBACK
172.17.0.1 - - [28/Mar/2018 14:30:49] "GET /cm2/1 HTTP/1.1" 200 -

This is the last print screen after I was trying in different page.

enter image description here

These are my imports, is it something what is not compatible?

import os
import base64
from io import BytesIO
from flask import Flask, render_template,request, redirect, url_for, flash, session, \
    abort,flash, g
from flask_sqlalchemy import SQLAlchemy, BaseQuery
from flask_security import current_user, login_required, RoleMixin, Security, \
    SQLAlchemyUserDatastore, UserMixin, utils
from flask_mail import Mail
from flask_bootstrap import Bootstrap

from wtforms.fields import StringField, PasswordField, SubmitField, SelectField
from wtforms.validators import Required, Length, EqualTo

from datetime import datetime, date, time, timedelta
from sqlalchemy import Table, Column, Integer, ForeignKey, desc
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base

Is it possible someone to help me in this case?!!!

The issue possible to be why is working query.filter_by and query.order is working partial without displaying data.

0

The issue was related to db in template I was defining wrong the table when I was adding the {% for xxx in YYYY %}

This was the reason for what the table's rows were not displayed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .