diff --git a/src/purchase/management/commands/clear_all_data.py b/src/purchase/management/commands/clear_all_data.py index 9b03553..9757452 100644 --- a/src/purchase/management/commands/clear_all_data.py +++ b/src/purchase/management/commands/clear_all_data.py @@ -1,6 +1,6 @@ from django.core.management.base import BaseCommand -from purchase.models import Basket, BasketItem, PaymentMethod, Product +from purchase.models import Basket, BasketItem, Cache, PaymentMethod, Product class Command(BaseCommand): @@ -11,6 +11,7 @@ class Command(BaseCommand): self.delete(Basket) self.delete(Product) self.delete(PaymentMethod) + Cache.get_solo().refresh() def delete(self, cls): _, count = cls.objects.all().delete() diff --git a/src/purchase/management/commands/generate_dummy_baskets.py b/src/purchase/management/commands/generate_dummy_baskets.py index 7c9c75f..c466037 100644 --- a/src/purchase/management/commands/generate_dummy_baskets.py +++ b/src/purchase/management/commands/generate_dummy_baskets.py @@ -7,7 +7,7 @@ from django.core.management import call_command from django.core.management.base import BaseCommand from django.utils.timezone import now -from purchase.models import Basket, BasketItem, PaymentMethod, Product +from purchase.models import Basket, BasketItem, Cache, PaymentMethod, Product class Command(BaseCommand): @@ -25,6 +25,7 @@ class Command(BaseCommand): with freezegun.freeze_time(now() + timedelta(hours=hour)): count += self.generate_baskets(payment_methods, products) + Cache.get_solo().refresh() self.stdout.write(self.style.SUCCESS(f"Successfully created {count} baskets.")) def delete(self, cls):