+ #filters['letter'] = Q(sort_key__startswith=self.letter)
+
+ self.letters = ["0-9"] + [chr(a) for a in range(ord('a'), ord('z')+1)]
+
+ nobj = objects
+ for key, fltr in filters.items():
+ if key != 'qualifier':
+ nobj = nobj.filter(fltr)
+ self.qualifiers = Qualifier.objects.filter(note__in=nobj).distinct()
+
+ nobj = objects
+ for key, fltr in filters.items():
+ if key != 'language':
+ 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():
+ if key != 'fn_type':
+ 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)
+
+ return objects