skillbox/server/core/management/commands/hidesolutions.py

13 lines
414 B
Python

from django.core.management import BaseCommand
from books.models import Module
class Command(BaseCommand):
def handle(self, *args, **options):
self.stdout.write("Hiding solutions")
for module in Module.objects.all():
self.stdout.write("Hiding solutions in module {}.".format(module.title))
module.solutions_enabled_by.clear()
self.stdout.write("Hiding done")