Fixes #4021: Ebook files regeneration mechanism.
[wolnelektury.git] / src / catalogue / management / commands / schedule_stale_ebooks.py
diff --git a/src/catalogue/management/commands/schedule_stale_ebooks.py b/src/catalogue/management/commands/schedule_stale_ebooks.py
new file mode 100644 (file)
index 0000000..91836fb
--- /dev/null
@@ -0,0 +1,14 @@
+# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
+from django.conf import settings
+from django.core.management.base import BaseCommand
+
+from catalogue.fields import EbookField
+
+
+class Command(BaseCommand):
+    help = 'Schedule regenerating stale ebook files.'
+
+    def handle(self, **options):
+        EbookField.schedule_all_stale()