How can I create a table or form with the addition of values from another table based on the selected values?
Good day! I have several model tables. And each subsequent table in the conditional hierarchy is one step lower than the previous one. I have one model that is planned to be filled from the form in the database.
And I plan to create another table that will be filled based on the data from the first model.
I plan to select an element from the form in the list - the first field and based on the selected value in the first field --->>>
--->>> accordingly copy some values of the corresponding fields from the corresponding row of the model table.
When selecting a certain field, take values from other fields of the same row and send them to another table of the model.
Send them to another table of the model with the addition of other data.
Conventionally speaking, this is like reproducing the first table into several. The second table can have 20 times more rows than the first.
How can I create a table or form with the addition of values from another table based on the selected values?
class CreateNewGPR (models.Model):
name_object = models.IntegerField(verbose_name="Наименование объекта")
name_working = models.CharField(verbose_name="Наименование работы")
type_izm = models.CharField(choices=TYPE_IZMERENIYA, verbose_name="Единицы измерения")
value_work = models.FloatField(verbose_name="Объём работ")
lyudi_norma = models.IntegerField(verbose_name="Нормативные затраты персонала")
technik_norma = models.IntegerField(verbose_name="Нормативные затраты техники")
date_begin = models.DateField(verbose_name="Дата начала работ")
date_end = models.DateField(verbose_name="Дата окончания работ")
class CreateNewWorkDay (models.Model):
name_object = models.IntegerField(verbose_name="Наименование объекта")
name_working = models.CharField(verbose_name="Наименование работы")
type_izm = models.CharField(choices=TYPE_IZMERENIYA, verbose_name="Единицы измерения")
value_work = models.FloatField(verbose_name="Объём работ")
lyudi_norma = models.IntegerField(verbose_name="Нормативные затраты персонала")
technik_norma = models.IntegerField(verbose_name="Нормативные затраты техники")
lyudi_fact = models.IntegerField(verbose_name="Нормативные затраты персонала")
technik_fact = models.IntegerField(verbose_name="Нормативные затраты техники")
date_day = models.DateField(verbose_name="Дата")