1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-22 04:54:18 +00:00

#bugfix Prevista la possibilita' che non esista la data nel database legata a un repository, e restituita stringa vuota nel json in quel caso

This commit is contained in:
g.minoccari 2021-05-07 10:16:57 +02:00
parent e6163d41c3
commit 93d01cb158

View file

@ -22,5 +22,5 @@ class Repository(Base.Model):
uses = Base.relationship("Uses", back_populates="repository")
def to_json(self):
return {"id": self.id, "name": self.name, "start": self.start.isoformat(), "isActive":self.isActive,
"end":self.end.isoformat(),"owner": self.owner.to_json()}
return {"id": self.id, "name": self.name, "start": (self.start.isoformat() if self.start is not None else ""), "isActive":self.isActive,
"end":(self.end.isoformat() if self.end is not None else ""),"owner": self.owner.to_json()}