cached facet results

This commit is contained in:
smilerz
2021-09-26 16:44:12 -05:00
parent b7be5cd325
commit b3cffa4a38
23 changed files with 336 additions and 171 deletions

View File

@ -385,7 +385,7 @@ class Food(ExportModelOperationsMixin('food'), TreeModel, PermissionModelMixin):
return self.name
def delete(self):
if len(self.ingredient_set.all().exclude(step=None)) > 0:
if self.ingredient_set.all().exclude(step=None).count() > 0:
raise ProtectedError(self.name + _(" is part of a recipe step and cannot be deleted"), self.ingredient_set.all().exclude(step=None))
else:
return super().delete()