X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/3a3123ecda265f9fa1becea878427d4d20a54f19..ce50d74eab3826c1cb464864867769ba1cbbcf53:/philo/models/base.py?ds=sidebyside diff --git a/philo/models/base.py b/philo/models/base.py index 86569b7..2f798ae 100644 --- a/philo/models/base.py +++ b/philo/models/base.py @@ -319,7 +319,12 @@ class Entity(models.Model): """ return mapper(self) - attributes = property(get_attribute_mapper) + + @property + def attributes(self): + if not hasattr(self, '_attributes'): + self._attributes = self.get_attribute_mapper() + return self._attributes class Meta: abstract = True @@ -500,7 +505,6 @@ class TreeEntity(Entity, MPTTModel): else: mapper = AttributeMapper return super(TreeEntity, self).get_attribute_mapper(mapper) - attributes = property(get_attribute_mapper) def __unicode__(self): return self.path