Move code to calculate an index descendant node instances to the model, catch exception when index is still not initialized, possible cause of issue #28

This commit is contained in:
Roberto Rosario
2012-10-07 04:19:16 -04:00
parent 8b52c4a99a
commit aa2e32e801
2 changed files with 7 additions and 1 deletions

View File

@@ -53,6 +53,12 @@ class Index(models.Model):
def natural_key(self):
return (self.name,)
def get_instance_node_count(self):
try:
return self.instance_root.get_descendant_count()
except IndexInstanceNode.DoesNotExist:
return 0
class Meta:
verbose_name = _(u'index')
verbose_name_plural = _(u'indexes')