fnp
/
edumed.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b4c1e57
)
option to exclude lessons by slugs
author
Jan Szejko
<janek37@gmail.com>
Wed, 25 Jan 2017 16:16:58 +0000
(17:16 +0100)
committer
Jan Szejko
<janek37@gmail.com>
Wed, 25 Jan 2017 16:16:58 +0000
(17:16 +0100)
catalogue/management/commands/republish.py
patch
|
blob
|
history
diff --git
a/catalogue/management/commands/republish.py
b/catalogue/management/commands/republish.py
index
5c3b429
..
3ed17d1
100644
(file)
--- a/
catalogue/management/commands/republish.py
+++ b/
catalogue/management/commands/republish.py
@@
-2,17
+2,34
@@
# This file is part of EduMed, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
# This file is part of EduMed, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
+from optparse import make_option
+
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Republishes all lessons.'
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Republishes all lessons.'
+ option_list = BaseCommand.option_list + (
+ make_option('--exclude', dest='exclude', metavar="PATH", default=None,
+ help='PATH to file with excluded lesson slugs.'),
+ make_option('--ignore-incomplete', action='store_true', dest='ignore_incomplete', default=False,
+ help='Attachments dir path.'),
+ make_option('--dont-repackage', action='store_false', dest='repackage', default=True,
+ help='Don\'t refresh level packages.'),
+ )
+
def handle(self, **options):
from catalogue.models import Lesson
from curriculum.models import Level
def handle(self, **options):
from catalogue.models import Lesson
from curriculum.models import Level
- for lesson in Lesson.objects.all():
+ lessons = Lesson.objects.order_by('slug')
+
+ if options.get('exclude'):
+ slugs = [line.strip() for line in open(options['exclude'])]
+ lessons = lessons.exclude(slug__in=slugs)
+
+ for lesson in lessons:
print
print 'Republishing: %s' % lesson.slug
# try:
print
print 'Republishing: %s' % lesson.slug
# try: