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_for.clear() self.stdout.write("Hiding done")