Fixes a bug trying to set active on decendants before object is saved.

This commit is contained in:
Corey Oordt 2011-08-29 06:39:00 -04:00
parent 1e049b9205
commit 2a0b4768a3

View file

@ -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'