hi!

i'am doing a particular application that requires multiple language

from django.db import models
from django.contrib import admin
from django.utils import translation

class MultiName(models.Model):
    for i in LANGUAGES:
        exec "name_%s = models.CharField(max_length = 255)" % i[0]

    def name(self):
        return eval('self.name_'+translation.get_language())
    name.admin_order_field = 'name_%s' % translation.get_language()

    def __unicode__(self):
        return u'%s' % self.name()

    class Meta:
        abstract = True
        ordering = ['name_'+LANGUAGE_CODE]


i would like to do the same thing for other values

i want to register inside the session the metric of the user
(centimeter, inches, ecc), and then use this value inside the unicode
of the model. so,

how django recover a value from the session using
translation.get_language()??

thanks

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