I am implementing a multi-lingual product catalog website with Django. It is in English (default), Trad. Chinese and Simp. Chinese. I want to let user to choose the language they want, and the system display the corresponding product name (in the selected language).
The product class is something like # ======= start class ============= class Product(models.Model) name_en = mode.CharField() name_tw = mode.CharField() name_cn = mode.CharField() def get_name(self, lang="en"): return eval("self.name_" + lang) # ======= end class ============= The language preference that user has chosen will be saved in request.session['django_language'] Of cos, i don't know how to use the get_name() function that i've implemented, because i can't pass the lang from view or template. So, the question is how do i get the request.session['django_language'] variable in models ? or is there any other way to achieve the desired result? Thanks in advance. Arnold --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---