calibre-web-companion/CalibreWebCompanion/library/context_processors.py

20 lines
708 B
Python
Raw Normal View History

from .models import Author, Tag, Publisher, Language, Rating, Series
2020-07-08 16:22:37 +00:00
def filters(request):
unique_authors = Author.objects.all().order_by('sort')
unique_tags = Tag.objects.all().order_by('name')
unique_publishers = Publisher.objects.all().order_by('name')
unique_languages = Language.objects.all()
unique_ratings = Rating.objects.all().order_by('rating')
2020-07-08 16:22:37 +00:00
unique_series = Series.objects.all().order_by('sort')
return {
"unique_authors": unique_authors,
"unique_tags": unique_tags,
"unique_publishers": unique_publishers,
"unique_languages": unique_languages,
"unique_ratings": unique_ratings,
"unique_series": unique_series
}