django-mothertongue icon indicating copy to clipboard operation
django-mothertongue copied to clipboard

max_len in language field at docs

Open chemt opened this issue 13 years ago • 2 comments

In docs there is example of using django-mothertongue

# chunks translations model
class GenericPageTranslation(models.Model):
    generic_page_instance = models.ForeignKey('GenericPage', verbose_name=_('generic_page'))
    language = models.CharField(max_length=len(settings.LANGUAGES)-1, choices=settings.LANGUAGES[1:])

Field language should have max_length = 10 (оr greather), but not len(settings.LANGUAGES)-1

chemt avatar Apr 14 '11 18:04 chemt

Agree with @chemt

zhangcheng avatar May 15 '11 09:05 zhangcheng

imho it should be 2. thats a sample settings.LANGUAGES:

LANGUAGES = (
    ('de', _('Deutsch')),
    ('en', _('English')),
)
  • the choices are all but the first one (settings.LANGUAGES[1:]). a possible improvement here would be to use the first component of LANGUAGE_CODE for the default language instead of the first in the list.
  • the language code saved in the language field are 'de' or 'en' ... a two letter language code.

fdemmer avatar Jul 04 '13 13:07 fdemmer