9👍
✅
It is okay to do that, especially if you will use the following pattern:
class SomeClass(models.Model):
@property
def is_complete(self):
if not hasattr(self, '_is_complete'):
related_objects = self.do_complicated_database_lookup()
self._is_complete = len(related_objects) == 0
return self._is_complete
Just remember that it “caches” the results, so first execution does calculation, but subsequent use existing results.
Source:stackexchange.com