[problem description] :
Diy with two tables in a database, diy_orders and diy_phone_shells respectively, the former record is mobile phone accessories order information, the record is mobile phone accessories information,
Diy_orders table structure as

Foreign key information below

Diy_phone_shells table structure as

No foreign keys,
Diy_order_phoneShellID field in the table: diy_orders equals diy_phone_shells phoneShellID fields in a table,
My code for
The from flask import flask, request, flash, url_for, redirect, render_template
The from flask_sqlalchemy import SQLAlchemy
App=Flask (__name__)
App. Config [' SQLALCHEMY_DATABASE_URI]='mysql://root: [email protected]:3306/diy'
App. Config [' SECRET_KEY ']="the random string"
The db=SQLAlchemy (app)
Class FuckOrders (the Model) :
__tablename__='diy_orders'
# id=db. The Column (' diy_order_id, db. The Integer, primary_key=True)
Diy_order_id=db. The Column (db. The Integer, primary_key=True)
# diy_order_phoneShellID=db. The Column ()
Diy_order_phoneShellID=db. The Column (the String, the ForeignKey (' PhonesShell. PhoneShellID))
Diy_order_phoneShellDESC=db. The relationship (' PhonesShell backref=db. Backref (' oders, lazy='dynamic'))
Def __init__ (self, diy_order_phoneShellID diy_order_phoneShellDESC) :
Self. Diy_order_phoneShellID=diy_order_phoneShellID
Self. Diy_order_phoneShellDESC=diy_order_phoneShellDESC
Class PhonesShell (the Model) :
__tablename__='diy_phone_shells'
Id=db. The Column (' phoneShellKeyId, db. The Integer, primary_key=True)
# phoneShellID=db. The Column (the Integer)
PhoneShellDesc=db. The Column (the String)
PhoneShellID=db. The relationship (' FuckOrders' backref='diy_order_phoneShellID')
Def __init__ (self, phoneShellID phoneShellDesc) :
Self. PhoneShellID=phoneShellID
Self. PhoneShellDesc=phoneShellDesc
@ app. The route ('/')
Def Show_Orders () :
Return render_template (' Order_Lists. HTML, HiOrders=FuckOrders. Query. All ())
# return render_template (' Order_Lists. HTML, HiOrders=db. The session. The execute (" select * from diy_orders o INNER JOIN diy_phone_shells s on o.d iy_order_phoneShellID=supachai panitchpakdi honeShellID ORDER BY o. chua reateDateObj DESC "))
If __name__=="__main__ ':
# the create_all ()
App. The run (debug=True)
[error]

[want to achieve the goal of] :
According to the diy_orders diy_order_phoneShellID fields in a table query diy_phone_shells corresponding phoneShellDesc information in the table, and,