Delete categories when clearing

This commit is contained in:
Gabriel Augendre 2023-04-02 19:34:06 +02:00
parent 5998a280ba
commit 61edce6e69

View file

@ -1,6 +1,13 @@
from django.core.management.base import BaseCommand 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): class Command(BaseCommand):
@ -11,6 +18,7 @@ class Command(BaseCommand):
self.delete(Basket) self.delete(Basket)
self.delete(Product) self.delete(Product)
self.delete(PaymentMethod) self.delete(PaymentMethod)
self.delete(ProductCategory)
Cache.get_solo().refresh() Cache.get_solo().refresh()
def delete(self, cls): def delete(self, cls):