Commit 90d3dc37 by Rocky Duan

fixed bug caused by missing course_id in retrieved comments

parent fcd2a2c7
...@@ -4,6 +4,7 @@ from django.http import HttpResponse ...@@ -4,6 +4,7 @@ from django.http import HttpResponse
from django.utils import simplejson from django.utils import simplejson
from django.core.context_processors import csrf from django.core.context_processors import csrf
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from mitxmako.shortcuts import render_to_response, render_to_string from mitxmako.shortcuts import render_to_response, render_to_string
from courseware.courses import check_course from courseware.courses import check_course
...@@ -167,7 +168,7 @@ def single_thread(request, course_id, discussion_id, thread_id): ...@@ -167,7 +168,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
thread = cc.Thread.find(thread_id).retrieve(recursive=True) thread = cc.Thread.find(thread_id).retrieve(recursive=True)
annotated_content_info = utils.get_annotated_content_infos(course_id, thread, request.user, type='thread') annotated_content_info = utils.get_annotated_content_infos(course_id, thread, request.user, type='thread')
context = {'thread': thread.to_dict()} context = {'thread': thread.to_dict(), 'course_id': course_id}
html = render_to_string('discussion/_ajax_single_thread.html', context) html = render_to_string('discussion/_ajax_single_thread.html', context)
return utils.JsonResponse({ return utils.JsonResponse({
...@@ -185,6 +186,7 @@ def single_thread(request, course_id, discussion_id, thread_id): ...@@ -185,6 +186,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
'content': render_single_thread(request, discussion_id, course_id, thread_id), 'content': render_single_thread(request, discussion_id, course_id, thread_id),
'accordion': render_accordion(request, course, discussion_id), 'accordion': render_accordion(request, course, discussion_id),
'course': course, 'course': course,
'course_id': course.id,
} }
return render_to_response('discussion/index.html', context) return render_to_response('discussion/index.html', context)
...@@ -198,9 +200,8 @@ def user_profile(request, course_id, user_id): ...@@ -198,9 +200,8 @@ def user_profile(request, course_id, user_id):
context = { context = {
'course': course, 'course': course,
'user': request.user, 'user': request.user,
'django_user': User.objects.get(id=user_id),
'discussion_user': discussion_user.to_dict(), 'discussion_user': discussion_user.to_dict(),
} }
print context
return render_to_response('discussion/user_profile.html', context) return render_to_response('discussion/user_profile.html', context)
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
<%def name="render_info(content)"> <%def name="render_info(content)">
<% <%
def url_for_user(user_id): def url_for_user(user_id):
import pdb; pdb.set_trace()
return reverse('django_comment_client.forum.views.user_profile', args=[course_id, user_id]) return reverse('django_comment_client.forum.views.user_profile', args=[course_id, user_id])
%> %>
<div class="comment-time"> <div class="comment-time">
......
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