X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/d1dfe30baf0d5ad52107d26de23e11c7c10d0847..5da36a259abcc9fb76b736fc360560f0ff931640:/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