Skip to content

Commit

Permalink
Año para el modelo de un auto
Browse files Browse the repository at this point in the history
  • Loading branch information
logos914 committed Nov 20, 2024
1 parent 6ffc834 commit acb77f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion models/modelo_vehiculo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ class ModeloVehiculo(db.Model):
nombre: Mapped[str] = mapped_column(unique=True, nullable=False)
marca: Mapped['MarcaVehiculo'] = relationship('MarcaVehiculo', backref='modelos')
litrosx100km: Mapped[float]
anio: Mapped[int] = mapped_column(nullable=True)

def serialize(self):
return {
'id': self.id,
'marca_vehiculo': self.marca.serialize() if self.marca else None,
'nombre': self.nombre,
'litrosx100km': self.litrosx100km
'litrosx100km': self.litrosx100km,
'anio': self.anio
}

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions routes/modelos_vehiculos.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def actualizar_marca(id):
modelo.id_marca_vehiculo = data.get('id_marca_vehiculo')
modelo.nombre = data.get('nombre', modelo.nombre)
modelo.litrosx100km = data.get('litrosx100km', modelo.litrosx100km)
modelo.anio = data.get('anio', modelo.anio)
ModeloVehiculo.actualizar()
return 'OK', 202

Expand Down

0 comments on commit acb77f2

Please sign in to comment.