Replace the DOCUMENTS_LANGUAGE_CHOICES setting option. Replaced with the new DOCUMENTS_LANGUAGE_CODES.

Reduce default language code choice from 7800 to the top 100 spoken languages and related (https://en.wikipedia.org/wiki/List_of_languages_by_number_of_native_speakers).

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-06-03 02:53:45 -04:00
parent 9896f7d52a
commit 2ee73e12b4
8 changed files with 48 additions and 15 deletions

View File

@@ -17,7 +17,7 @@ from .models import (
)
from .literals import DEFAULT_ZIP_FILENAME, PAGE_RANGE_ALL, PAGE_RANGE_CHOICES
from .permissions import permission_document_create
from .settings import setting_language_choices
from .runtime import language_choices
logger = logging.getLogger(__name__)
@@ -67,7 +67,7 @@ class DocumentForm(forms.ModelForm):
model = Document
widgets = {
'language': forms.Select(
choices=setting_language_choices.value, attrs={
choices=language_choices, attrs={
'class': 'select2'
}
)
@@ -120,7 +120,7 @@ class DocumentPropertiesForm(DetailForm):
{'label': _('UUID'), 'field': 'uuid'},
{
'label': _('Language'),
'field': lambda x: dict(setting_language_choices.value).get(
'field': lambda x: dict(language_choices).get(
document.language, _('Unknown')
)
},