Answer the question
In order to leave comments, you need to log in
What is the best way to organize models?
Hello, there are some models like this:
LANG = (
('unknown', _('Unknown')),
('abk', _('Abkhazian')),
('ace', _('Achinese')),
('ach', _('Acoli')),
('eng', _('English')),
('rus', _('Russian'))
...
)
class Edition(models.Model):
name = models.CharField(max_length=200)
description = models.TextField(blank=True)
lang = models.IntegerField(choices=LANG)
book = models.ForeignKey('Book')
class Book(models.Model):
pass
Answer the question
In order to leave comments, you need to log in
Depending on how the edition and its description are connected. It is
more logical that each edition has its own description.
Those do not make a separate model for descriptions.
Store language-description pairs in jsonfield or hstore, although you will have to work on the admin panel. It is easier and more convenient, indeed, to store in a separate model
The only decision that comes to my mind is to move descrition into a separate model and from Edition make fk on it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question