0

I am using this model-translation package

everything works fine now in admin, i created an object in admin with english content. and my page is actually in german. .. e.g. starts with /de/blabla/.

then I opened the page which should render all items from db of a model. in my views i did

from django.utils.translation import get_language
print get_language()
bloglists = models.BlogList.objects.filter()

I am getting de for get_language() and the query is giving me still the english content.

but the docs say:

Assuming the current language is de in the news example from above, the translated title field will return the value from the title_de field:

# Assuming the current language is "de"
n = News.objects.all()[0]
t = n.title  # returns german translation

# Assuming the current language is "en"
t = n.title  # returns english translation

but why not working for me? am I doing something wrong?

doniyor
  • 36,596
  • 57
  • 175
  • 260

1 Answers1

0

ok never mind. the solution was:

I had to first create an entry in default language and then create the other translations. and then the "rendering the right language content" works.

cool stuff.

doniyor
  • 36,596
  • 57
  • 175
  • 260