Commit 3e0bd55c by Robert Raposa Committed by GitHub

Merge pull request #13445 from edx/robrap/TNL-5240

TNL-5240: Cache comment thread.
parents 4b9ab319 43590510
......@@ -27,9 +27,15 @@ class Comment(models.Model):
base_url = "{prefix}/comments".format(prefix=settings.PREFIX)
type = 'comment'
def __init__(self, *args, **kwargs):
super(Comment, self).__init__(*args, **kwargs)
self._cached_thread = None
@property
def thread(self):
return Thread(id=self.thread_id, type='thread')
if not self._cached_thread:
self._cached_thread = Thread(id=self.thread_id, type='thread')
return self._cached_thread
@property
def context(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment