X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/2d755ff729a4752c26b8dc3526f7ef0dc2c39fc0..82c3054bcdeb000aa9782da80d644070797b5cbe:/apps/dictionary/views.py diff --git a/apps/dictionary/views.py b/apps/dictionary/views.py index 76530bc42..69c6bf65c 100755 --- a/apps/dictionary/views.py +++ b/apps/dictionary/views.py @@ -3,14 +3,16 @@ # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from django.views.generic.list import ListView +from django.conf import settings from django.db.models import Count, Q +from catalogue.constants import LANGUAGES_3TO2 from .constants import FN_TYPES from .models import Note, Qualifier class NotesView(ListView): def get_queryset(self): - objects = Note.objects.select_related('book').all() + objects = Note.objects.all() filters = {} try: @@ -50,6 +52,10 @@ class NotesView(ListView): nobj = nobj.filter(fltr) self.languages = nobj.order_by('language').values_list( 'language', flat=True).distinct() + lang_names = dict(settings.LANGUAGES) + self.languages = [ + (lang, lang_names.get(LANGUAGES_3TO2.get(lang, lang), lang)) + for lang in self.languages] nobj = objects for key, fltr in filters.items():