How can I perform calculations from the queryset of one model add them to the fields of another model?
I have two Django table models. And even the result of the query after the filter operation with the model table. One of these tables contains data that is populated using a Django form.
Another table can be filled only with data obtained after performing calculations with data from the first table.
How can I fill in a row or add a second table? I need to perform calculations with the last row from the first table and send the results to the second table. This is something reminiscent of processing data in two DataFrame .
How can I add a table of values to the model after performing calculations on the data from the last row from another table model?
class Model_1(models.Model): name_1 = models.IntegerField() name_2 = models.IntegerField() name_3 = models.IntegerField() name_4 = models.IntegerField() class Model_2(models.Model): name_5 = models.IntegerField() name_6 = models.IntegerField() queryset = Model_1.objects.all() values_m1 = queryst.name_1 * queryst.name_2 / queryst.name_3 - queryst.name_4 queryset = Model_2.objects.all() values_m2 = queryst.name_5 = values_m1