[Python] How can I connect multiple model tables Django for data import export?

Discussão em 'Python' iniciado por Stack, Maio 23, 2025.

  1. Stack

    Stack Membro Participativo

    I have three 3 Django model tables.

    They are kind of connected to each other so that each row, each line from one model table corresponds to the same from another model table.

    You could say that I'm just splitting one large model table into three 3 medium small ones.

    And each row, line from one model table is equal to belongs to another.

    Rows, rows from 3 tables - one row from 3 tables - these are the parameters of one object.

    How can I somehow connect these three 3 model tables? I'll be glad to any help. I want to save and upload data simultaneously to 3 model tables through the form.

    How can I somehow load and receive data.

    How can I connect multiple model tables for data import export? How can I connect multiple model tables for data import export as if it were one large model table - merged from 3 model tables?

    from django.db import models


    class Musician_1(models.Model):
    first_name_1 = models.CharField(max_length=50)
    last_name_1 = models.CharField(max_length=50)
    instrument_1 = models.CharField(max_length=100)


    class Musician_2(models.Model):
    first_name_2 = models.CharField(max_length=50)
    last_name_2 = models.CharField(max_length=50)
    instrument_2 = models.CharField(max_length=100)


    class Musician_3(models.Model):
    first_name_3 = models.CharField(max_length=50)
    last_name_3 = models.CharField(max_length=50)
    instrument_3 = models.CharField(max_length=100)

    Continue reading...

Compartilhe esta Página