Notas y bibliotecas funcionando

This commit is contained in:
2025-05-14 02:06:33 +02:00
parent bf1814bb8e
commit c13240b481
18 changed files with 266 additions and 168 deletions
+8 -2
View File
@@ -48,10 +48,16 @@ class Model_base:
def __json__(self) -> dict:
"""Devuelve una representación JSON serializable (dict plano)."""
out = {}
# Prevención de error: solo ejecuta si __table__ existe
if not hasattr(self, "__table__"):
return out
for attr in self.__table__.columns:
val = getattr(self, attr.name)
val = getattr(self, attr.name, None)
if isinstance(val, datetime):
out[attr.name] = val.isoformat()
else:
out[attr.name] = val
return out
return out