1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django.views.generic.list_detail import object_list
6 from dictionary.models import Note
8 def letter_notes(request, letter=None):
9 letters = ["0-9"] + [chr(a) for a in range(ord('a'), ord('z')+1)]
10 objects = Note.objects.all()
12 objects = objects.filter(sort_key__regex=r"^[0-9]")
14 objects = objects.filter(sort_key__startswith=letter)
16 return object_list(request, queryset=objects, extra_context=locals())