From 2a0b4768a319c19a8c05b32868e4c3198a26d8ee Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Mon, 29 Aug 2011 06:39:00 -0400 Subject: [PATCH] Fixes a bug trying to set active on decendants before object is saved. --- categories/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/categories/models.py b/categories/models.py index 8ff4c19..a1d86c9 100644 --- a/categories/models.py +++ b/categories/models.py @@ -101,11 +101,12 @@ class Category(MPTTModel): self.thumbnail_width = width self.thumbnail_height = height + super(Category, self).save(*args, **kwargs) + for item in self.get_descendants(): if item.active != self.active: item.active = self.active item.save() - super(Category, self).save(*args, **kwargs) class Meta: verbose_name_plural = 'categories'