Hi people,
I'm new in django, so i have simple questions. Sorry for that.
I want to develop a simple app to make entries in stock. To start i
install the jet dashboard and start an app called polls:
https://ibin.co/3LmUv6rGJRXt.png
I want to add a entrie and inside i need to have a table where i
will insert the news produts to the entrie. I have this now, but i
need that which new product have a column with the liquid weight
(pesoliquido) that is an equation:
class InputDetail(models.Model):
input = models.ForeignKey(Entrada,on_delete=models.CASCADE)
produto = models.CharField(max_length=200);
weight = models.PositiveSmallIntegerField();
caixas = models.PositiveSmallIntegerField();
pesocaixas = models.PositiveSmallIntegerField();
pesopaletes = models.PositiveSmallIntegerField();
def _get_liquid(self):
return self.weight - (self.caixas * self.pesocaixas) -
self.pesopaletes
pesoliquido = property(_get_liquid)
white = 'white'
green = 'green'
tipopalete = (
(white,'Jaulas Brancas'),
(green,'Jaulas Verdes'),
)
palete = models.CharField(
max_length=20,
choices=tipopalete,
default=white,
)
the liquid weight should be the equation and if the user want an
entrie to insert the value. The table of the products inserted
should have the sum of all liquid weight. How can i do this? I want
too a popup window to insert the products..
Thanks guys