Clear cache during `reset` operation

This commit is contained in:
Christopher C. Wells 2020-01-28 21:55:54 -08:00 committed by Christopher Charbonneau Wells
parent fd6bcfe9a5
commit 6662d1036d
1 changed files with 6 additions and 0 deletions

View File

@ -3,6 +3,7 @@ from os import path
from django.apps import apps from django.apps import apps
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.core.cache import cache
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.core.management.commands.flush import Command as Flush from django.core.management.commands.flush import Command as Flush
@ -51,6 +52,11 @@ class Command(BaseCommand):
options['migration_name'] = None options['migration_name'] = None
migrate.handle(*args, **options) migrate.handle(*args, **options)
# Clear cache.
cache.clear()
if verbosity > 0:
self.stdout.write(self.style.SUCCESS('Cache cleared.'))
# Populate database with fake data. # Populate database with fake data.
fake = Fake() fake = Fake()
fake.handle(*args, **options) fake.handle(*args, **options)