1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 from datetime import date
5 from django.core.management.base import BaseCommand
7 from catalogue.models import Book
10 class Command(BaseCommand):
11 def handle(self, *args, **options):
12 for book in Book.objects.filter(preview=True, preview_until__lt=date.today()):
15 for format_ in Book.formats:
16 media_file = book.get_media(format_)
18 media_file.set_readable(True)