problem description
relationship, with flask sqlalehemy cannot be called. An error message appears
TypeError: "InstrumentedAttribute" object is not callable
the environmental background of the problems and what methods you have tried
python 3.7
related codes
/ / Please paste the code text below (do not replace the code with pictures)
- vehicle task table
class CarJob(db.Model):
"""
:
:t_carjob_application
:t_carjob_tasks
:t_carjob_scores
"""
__tablename__ = "t_carjob"
id = db.Column(db.Integer, primary_key=True)
jobdate = db.Column(db.DateTime, unique=True) -sharp
jobtime = db.Column(db.String(5), unique=True) -sharp
timestamp = db.Column(db.DateTime, index=True, default=datetime.utcnow)
jobdetail = db.Column(db.String(200)) -sharp
-sharp
passengers = db.relationship("CarJob_Application", backref="jobs",lazy="dynamic")
-sharp
drivers = db.relationship("CarJob_Task", backref="jobs",lazy="dynamic")
def __repr__(self):
return "<CarJob {}>".format(self.id)
- employee application form
class CarJob_Application(db.Model):
"""
"""
__tablename__ = "t_carjob_application"
id = db.Column(db.Integer, primary_key = True)
userid = db.Column(db.String(20), db.ForeignKey("user.userid"))
jobid = db.Column(db.Integer, db.ForeignKey("t_carjob.id"))
def is_applied(self, userid):
"""
"""
return False
- driver schedule
class CarJob_Task(db.Model):
"""
"""
__tablename__ = "t_carjob_task"
id = db.Column(db.Integer, primary_key = True)
driverid = db.Column(db.String(20), db.ForeignKey("user.userid")) -sharpiduseruserid
jobid = db.Column(db.Integer, db.ForeignKey("t_carjob.id"))
scores = db.Column(db.Integer) -sharp
- template list.html
{% extends "base.html" %}
{% block app_content %}
<ul class="list-group">
{% for driver in drivers %}
<li class="list-group-item">:{{ driver.id }} :<b>{{ driver.id }}</b> </li>
{% endfor %}
</ul>
{% endblock %}
what result do you expect? What is the error message actually seen?
- want to be able to list employee application information and assigned driver information for a certain period of time.