diff --git a/app/main/templates/agent.html b/app/main/templates/agent.html
index e2a2b7b..f4d1b24 100644
--- a/app/main/templates/agent.html
+++ b/app/main/templates/agent.html
@@ -28,13 +28,13 @@
Statut :
- {{agent.status_id}}
+ {{agent.status.name}}
Organisme :
- {{agent.company_id}}
+ {{agent.company.name}}
Corps :
BAP :
- {{agent.bap_id}}
+ {{agent.bap.name}}
{# TODO: puth different spacing #}
diff --git a/app/models.py b/app/models.py
index 07b1fa3..828e54f 100644
--- a/app/models.py
+++ b/app/models.py
@@ -46,33 +46,41 @@ class ProjectLabel(db.Model):
class AgentBap(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(16))
+ agents = relationship("Agent", back_populates="bap")
class AgentGrade(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(16))
+ agents = relationship("Agent", back_populates="grade")
class AgentStatus(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(16))
+ agents = relationship("Agent", back_populates="status")
class Company(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(16))
+ agents = relationship("Agent", back_populates="company")
class Agent(db.Model):
id = db.Column(db.Integer, primary_key=True)
firstname = db.Column(db.String(100))
secondname = db.Column(db.String(100))
+ virtual = db.Column(db.Integer) # integer boolean
+ permanent = db.Column(db.Integer) # integer boolean
company_id = db.Column(db.Integer, db.ForeignKey('company.id'))
grade_id = db.Column(db.Integer, db.ForeignKey('agent_grade.id'))
status_id = db.Column(db.Integer, db.ForeignKey('agent_status.id'))
bap_id = db.Column(db.Integer, db.ForeignKey('agent_bap.id'))
- virtual = db.Column(db.Integer) # integer boolean
- permanent = db.Column(db.Integer) # integer boolean
+ grade = relationship("AgentGrade", back_populates="agents")
+ bap = relationship("AgentBap", back_populates="agents")
+ status = relationship("AgentStatus", back_populates="agents")
+ company = relationship("Company", back_populates="agents")
class Service(db.Model):
--
libgit2 0.21.2