From 61edce6e69f1e2f20c816917a312278a18840365 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sun, 2 Apr 2023 19:34:06 +0200 Subject: [PATCH] Delete categories when clearing --- src/purchase/management/commands/clear_all_data.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/purchase/management/commands/clear_all_data.py b/src/purchase/management/commands/clear_all_data.py index 9757452..38b7b8a 100644 --- a/src/purchase/management/commands/clear_all_data.py +++ b/src/purchase/management/commands/clear_all_data.py @@ -1,6 +1,13 @@ from django.core.management.base import BaseCommand -from purchase.models import Basket, BasketItem, Cache, PaymentMethod, Product +from purchase.models import ( + Basket, + BasketItem, + Cache, + PaymentMethod, + Product, + ProductCategory, +) class Command(BaseCommand): @@ -11,6 +18,7 @@ class Command(BaseCommand): self.delete(Basket) self.delete(Product) self.delete(PaymentMethod) + self.delete(ProductCategory) Cache.get_solo().refresh() def delete(self, cls):