Answer the question
In order to leave comments, you need to log in
How to store data in the database and which connection to choose?
There are three tables. How correct is the approach of such nested ManyToMany? Does it affect the database load? Quote.text is a unique value (quote) for each book. How to organize Quote.translate to store data in this form:
drive drive drive drive drive drive lead
class Translate(models.Model):
text = models.TextField(blank=True, null=True)
class Quote(models.Model):
text = models.TextField(blank=True, null=True)
translate = models.ManyToManyField(Translate, blank=True)
class Book(models.Model):
name = models.TextField(unique=True)
quote = models.ManyToManyField(Quote, blank=True)
class Book(models.Model):
name = models.TextField(unique=True)
class Quote(models.Model):
book= models.ForeignKey(Book, on_delete=CASCADE)
class Translate(models.Model):
quote= models.ForeignKey(Quote, on_delete=CASCADE)
Answer the question
In order to leave comments, you need to log in
Obviously, one quote cannot be from different books, just as one translation cannot be different phrases, so the ratio must definitely be one to many.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question