skillbox/server/books/management/commands/categorize_modules.py

19 lines
606 B
Python

from django.core.management import BaseCommand
from books.categorize_modules import categorize_modules, delete_unused_levels, uncategorize_modules, \
delete_unused_categories
from books.categorize_modules import create_default_levels_and_categories
class Command(BaseCommand):
def handle(self, *args, **options):
self.stdout.write("Categorizing modules")
uncategorize_modules()
create_default_levels_and_categories()
categorize_modules()
delete_unused_levels()
delete_unused_categories()
self.stdout.write("Finish categorizing modules")