fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix in librarian
[wolnelektury.git]
/
apps
/
dictionary
/
views.py
diff --git
a/apps/dictionary/views.py
b/apps/dictionary/views.py
index
42aab6c
..
69c6bf6
100755
(executable)
--- a/
apps/dictionary/views.py
+++ b/
apps/dictionary/views.py
@@
-2,14
+2,17
@@
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
-from dictionary.models import Note, Qualifier
from django.views.generic.list import ListView
from django.views.generic.list import ListView
+from django.conf import settings
from django.db.models import Count, Q
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):
class NotesView(ListView):
def get_queryset(self):
- objects = Note.objects.
select_related('book').
all()
+ objects = Note.objects.all()
filters = {}
try:
filters = {}
try:
@@
-49,6
+52,10
@@
class NotesView(ListView):
nobj = nobj.filter(fltr)
self.languages = nobj.order_by('language').values_list(
'language', flat=True).distinct()
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():
nobj = objects
for key, fltr in filters.items():
@@
-56,6
+63,7
@@
class NotesView(ListView):
nobj = nobj.filter(fltr)
self.fn_types = nobj.order_by('fn_type').values_list(
'fn_type', flat=True).distinct()
nobj = nobj.filter(fltr)
self.fn_types = nobj.order_by('fn_type').values_list(
'fn_type', flat=True).distinct()
+ self.fn_types = [(fnt, FN_TYPES[fnt]) for fnt in self.fn_types]
for f in filters.values():
objects = objects.filter(f)
for f in filters.values():
objects = objects.filter(f)