I think that better idea would be doing something like that (I'm using
even more complicated models myself):

class Page(models.Model):
        #parent page in tree of pages
        parent = models.ForeignKey('self', related_name="children",
blank=True, null=True)
        slug = models.SlugField(unique=True)
        #name for admin page listing
        name = models.CharField(max_length=255)
        #short description for admin page listing
        descr = models.TextField()
        #relative order of silblings
        order = models.IntegerField()
        author = models.ForeignKey(User)

class Content(models.Model):
        #melongs to which page
        page = models.ForeignKey(Page)
        author = models.ForeignKey(User)
        #version in what language
        lang = models.CharField(max_length=3)
        title = models.CharField(max_length=255)
        content = models.TextField()
        COMPONENTS = (
            ('article', 'Article'),
            ('news', 'News'),
            ('partners', 'Partners'),
        )
        component = models.CharField(max_length=50, choices=COMPONENTS)
        #is page published for this language version
        published = models.BooleanField()
        #template = models.ForeignKey(Template)

We got relational database so lets use relations to be more efficient
and have less data redunddancy.
To explain a bit more class Page has one row per each page and has
related as many rows in Content class as the number of languages. Just
keep current language in session and use it to filter content rows to
get the one you need. All the data that is shared among instances of
page for each language is kept in Page class (less data redundancy).
All the data that differs between languages is kept in Content (we
read from database to memory only the data for one language - thats
efficiency).

Hope that helps :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to