Commit 4139f702 by Kevin Chugh

debugging thread

parent 28e86f96
...@@ -161,21 +161,19 @@ def forum_form_discussion(request, course_id): ...@@ -161,21 +161,19 @@ def forum_form_discussion(request, course_id):
@login_required @login_required
def single_thread(request, course_id, discussion_id, thread_id): def single_thread(request, course_id, discussion_id, thread_id):
course = get_course_with_access(request.user, course_id, 'load') course = get_course_with_access(request.user, course_id, 'load')
cc_user = cc.User.from_django_user(request.user) cc_user = cc.User.from_django_user(request.user)
user_info = cc_user.to_dict() user_info = cc_user.to_dict()
try: try:
thread = cc.Thread.find(thread_id).retrieve(recursive=True, user_id=request.user.id) thread = cc.Thread.find(thread_id).retrieve(recursive=True, user_id=request.user.id)
except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError) as err: except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError) as err:
log.error("Error loading single thread.") log.error("Error loading single thread.")
raise Http404 raise Http404
if request.is_ajax(): if request.is_ajax():
courseware_context = get_courseware_context(thread, course) courseware_context = get_courseware_context(thread, course)
annotated_content_info = utils.get_annotated_content_infos(course_id, thread, request.user, user_info=user_info) annotated_content_info = utils.get_annotated_content_infos(course_id, thread, request.user, user_info=user_info)
context = {'thread': thread.to_dict(), 'course_id': course_id} context = {'thread': thread.to_dict(), 'course_id': course_id}
# TODO: Remove completely or switch back to server side rendering # TODO: Remove completely or switch back to server side rendering
......
...@@ -26,6 +26,7 @@ class Thread(models.Model): ...@@ -26,6 +26,7 @@ class Thread(models.Model):
@classmethod @classmethod
def search(cls, query_params, *args, **kwargs): def search(cls, query_params, *args, **kwargs):
default_params = {'page': 1, default_params = {'page': 1,
'per_page': 20, 'per_page': 20,
'course_id': query_params['course_id'], 'course_id': query_params['course_id'],
...@@ -65,7 +66,6 @@ class Thread(models.Model): ...@@ -65,7 +66,6 @@ class Thread(models.Model):
# that subclasses don't need to override for this. # that subclasses don't need to override for this.
def _retrieve(self, *args, **kwargs): def _retrieve(self, *args, **kwargs):
url = self.url(action='get', params=self.attributes) url = self.url(action='get', params=self.attributes)
request_params = { request_params = {
'recursive': kwargs.get('recursive'), 'recursive': kwargs.get('recursive'),
'user_id': kwargs.get('user_id'), 'user_id': kwargs.get('user_id'),
......
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