Commit 07534a72 by Kevin Chugh

fix thread/thread id issue

parent 8280c559
...@@ -295,13 +295,13 @@ def undo_vote_for_thread(request, course_id, thread_id): ...@@ -295,13 +295,13 @@ def undo_vote_for_thread(request, course_id, thread_id):
def pin_thread(request, course_id, thread_id): def pin_thread(request, course_id, thread_id):
user = cc.User.from_django_user(request.user) user = cc.User.from_django_user(request.user)
thread = cc.Thread.find(thread_id) thread = cc.Thread.find(thread_id)
thread.pin(user,thread) thread.pin(user,thread_id)
return JsonResponse(utils.safe_content(thread.to_dict())) return JsonResponse(utils.safe_content(thread.to_dict()))
def un_pin_thread(request, course_id, thread_id): def un_pin_thread(request, course_id, thread_id):
user = cc.User.from_django_user(request.user) user = cc.User.from_django_user(request.user)
thread = cc.Thread.find(thread_id) thread = cc.Thread.find(thread_id)
thread.un_pin(user,thread) thread.un_pin(user,thread_id)
return JsonResponse(utils.safe_content(thread.to_dict())) return JsonResponse(utils.safe_content(thread.to_dict()))
......
...@@ -84,6 +84,8 @@ class Thread(models.Model): ...@@ -84,6 +84,8 @@ class Thread(models.Model):
url = _url_for_pin_thread(thread_id) url = _url_for_pin_thread(thread_id)
params = {'user_id': user.id} params = {'user_id': user.id}
request = perform_request('put', url, params) request = perform_request('put', url, params)
print "\n\n\n\n\n\n*******************"
print request
self.update_attributes(request) self.update_attributes(request)
def un_pin(self, user, thread_id): def un_pin(self, user, thread_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