from django.db import models class Tipo(models.Model): tipo = models.TextField(max_length=10) def __str__(self): return self.tipo class Cuenta(models.Model): nombre = models.TextField(max_length=20) saldo_inicial = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True) saldo_actual = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True) tipo = models.ForeignKey(Tipo, on_delete=models.CASCADE) def __str__(self): return self.nombre class Apunte(models.Model): fecha = models.DateField() cta_origen = models.ForeignKey(Cuenta, on_delete=models.CASCADE, related_name='origen') cta_destino = models.ForeignKey(Cuenta, on_delete=models.CASCADE, related_name='destino') importe = models.DecimalField(max_digits=10, decimal_places=2) concepto = models.TextField(max_length=30) def __str__(self): return self.fecha