I have 2 apps client and sale where the client has only one client table
class Cliente(models.Model):
nombre = models.CharField(max_length=100, verbose_name='Nombres')
and sale has 2 tables (Sale and retail detail) and product but that pulls from another table.
class Venta(models.Model):
cliente = models.ForeignKey(Cliente,on_delete=models.CASCADE,verbose_name='Cliente')
fecha = models.DateField()
detalle = models.CharField(max_length=300, verbose_name='Detalle del pedido')
class DetalleVenta(models.Model):
producto = models.ForeignKey(Producto,on_delete=models.CASCADE,verbose_name='Producto')
cantidad = models.IntegerField(verbose_name='Cantidad')
venta = models.ForeignKey(Venta,on_delete=models.CASCADE, verbose_name='Venta')
The problem I have is how I can add several sales details since they can be 1 or many details that can be generated when making a sale in the same form. Since if I create a form with the 2 models, there is only one detail recorded and with its sale but if they are more details?