django-mothertongue
django-mothertongue copied to clipboard
max_len in language field at docs
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
Agree with @chemt
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 ofLANGUAGE_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.