option to export non-publishable lesson
authorJan Szejko <janek37@gmail.com>
Tue, 26 Sep 2017 14:42:20 +0000 (16:42 +0200)
committerJan Szejko <janek37@gmail.com>
Tue, 26 Sep 2017 14:42:20 +0000 (16:42 +0200)
apps/catalogue/management/commands/export_lesson.py

index a059698..0f688b3 100644 (file)
@@ -1,4 +1,5 @@
 # -*- coding: utf-8 -*-
+from optparse import make_option
 
 from django.core.management.base import BaseCommand
 
@@ -8,7 +9,12 @@ from catalogue.models import Book
 class Command(BaseCommand):
     help = 'Exports a lesson in WL1 XML'
     args = 'slug'
+    option_list = BaseCommand.option_list + (
+        make_option(
+            '-c', '--current', action='store_false', dest='publishable', default=True,
+            help='Current version (even if not publishable)'),
+    )
 
     def handle(self, slug, *args, **options):
         lesson = Book.objects.get(slug=slug)
-        print lesson.wl1_xml()
\ No newline at end of file
+        print lesson.wl1_xml(publishable=options.get('publishable'))