i'm a beginner with django. (I just completed the tutorial and following this guide http://www.gettingstartedwithdjango.com) I want to make a site with multilingual content, and i would know which is the best practice, at least with the models:
- Use different tables (1 for each language)
- Use just one table, using an extra attribute in the model for the language
- I have no idea
Vladislav is in right, it all depends on the data the table is containing. So an example:
class Book(models.Model):
created_at = models.DateTimeField(auto_now_add=True, editable=False)
name = models.CharField(max_length=255, unique=True)
plot = models.TextField()
slug = models.SlugField(max_length=255, blank=True, default='')
class Chapter(models.Model):
book = models.ForeignKey(Book)
chapter = models.SmallIntegerField()
title = models.CharField(max_length=255, blank=True)
pages = models.SmallIntegerField()
pub_date = models.DateTimeField(auto_now_add=True)
Possibilities:
- I may have a complete book in all languages
- I may have a complete book in just 1 language
- I may have a complete book in 1 language, but just some chapters in another language
So i think that i must keep one instance of a book for each language which i've got at least one chapter of that book.
I hope that it is clear! Thanks again you all