Hi everyone,

I'm working on a bilingual website in django for which the visitor has
the option of choosing which language he/she prefers. All the interface,
as well as the content, will be available in Spanish and English. The
interface is set up to be handled by gettext and django's has excellent
support for that.

I'm having a hard time right now with the bilingual "posts" system,
which is for contributors to add articles in different categories. Each
post will have two items for it, one in each language.

The way I've got it set up in the models is:

######
# The parent of all the posts,
# only one item per post in here
######
class Post(models.Model):
    referencetitle = models.CharField(max_length=30)
    date = models.DateTimeField('Date')

######
# language content for each post
# there will be two items per post in here, one for each language
######
class PostI18N(models.Model):
    post = models.ForeignKey(Post)
    slug = models.SlugField(
        'Slug',
        help_text='Automatically built from the title.'
    )
    title = models.CharField('Title', max_length=30)
    body = models.TextField('Body Text')
    lang = models.CharField(max_length = 5, choices = settings.LANGUAGES)



How do it do this in _views _so that I only get the "PostI18N" items
that are in the current language chosen by the users, and how do I
iterate through both of these models at the same time in templates so
that I can access the Date field from the related table ("Post") to sort
them, but display the main content fields from "PostI18N".

I'm initially attempting to display this data using generic views
(django.views.generic.date_based.archive_index). Do you think these
generic views can handle something like this? If not, how would I write
an equivalent custom view?

Thanks for your help with this,
J


--~--~---------~--~----~------------~-------~--~----~
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