hook up panel to new stats service
This commit is contained in:
@@ -3,6 +3,7 @@ from django.conf.urls.defaults import url, patterns
|
||||
urlpatterns = patterns('django_comment_client.base.views', # nopep8
|
||||
url(r'upload$', 'upload', name='upload'),
|
||||
url(r'users/(?P<user_id>\w+)/update_moderator_status$', 'update_moderator_status', name='update_moderator_status'),
|
||||
url(r'panel/stats', 'user_stats', name='user_stats'),
|
||||
url(r'threads/tags/autocomplete$', 'tags_autocomplete', name='tags_autocomplete'),
|
||||
url(r'threads/(?P<thread_id>[\w\-]+)/update$', 'update_thread', name='update_thread'),
|
||||
url(r'threads/(?P<thread_id>[\w\-]+)/reply$', 'create_comment', name='create_comment'),
|
||||
@@ -17,7 +18,6 @@ urlpatterns = patterns('django_comment_client.base.views', # nopep8
|
||||
url(r'threads/(?P<thread_id>[\w\-]+)/follow$', 'follow_thread', name='follow_thread'),
|
||||
url(r'threads/(?P<thread_id>[\w\-]+)/unfollow$', 'unfollow_thread', name='unfollow_thread'),
|
||||
url(r'threads/(?P<thread_id>[\w\-]+)/close$', 'openclose_thread', name='openclose_thread'),
|
||||
|
||||
url(r'comments/(?P<comment_id>[\w\-]+)/update$', 'update_comment', name='update_comment'),
|
||||
url(r'comments/(?P<comment_id>[\w\-]+)/endorse$', 'endorse_comment', name='endorse_comment'),
|
||||
url(r'comments/(?P<comment_id>[\w\-]+)/reply$', 'create_sub_comment', name='create_sub_comment'),
|
||||
|
||||
@@ -649,3 +649,20 @@ def upload(request, course_id): # ajax upload file to a question or answer
|
||||
'file_url': file_url,
|
||||
}
|
||||
})
|
||||
|
||||
@login_required
|
||||
def user_stats(request, course_id):
|
||||
try:
|
||||
profiled_user = cc.User(id=request.user.id, course_id=course_id)
|
||||
print "\n\n\n*******************\n\n\n"
|
||||
print profiled_user.course_id
|
||||
query_params = {}
|
||||
|
||||
user_stats_results = profiled_user.stats(query_params)
|
||||
|
||||
return utils.JsonResponse({
|
||||
'stats': user_stats_results
|
||||
})
|
||||
|
||||
except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError, User.DoesNotExist):
|
||||
raise Http404
|
||||
|
||||
@@ -4,6 +4,7 @@ urlpatterns = patterns('django_comment_client.forum.views', # nopep8
|
||||
url(r'users/(?P<user_id>\w+)/followed$', 'followed_threads', name='followed_threads'),
|
||||
url(r'users/(?P<user_id>\w+)$', 'user_profile', name='user_profile'),
|
||||
url(r'^(?P<discussion_id>[\w\-.]+)/threads/(?P<thread_id>\w+)$', 'single_thread', name='single_thread'),
|
||||
url(r'^(?P<discussion_id>[\w\-.]+)/threads/(?P<thread_id>\w+)$', 'single_thread', name='single_thread'),
|
||||
url(r'^(?P<discussion_id>[\w\-.]+)/inline$', 'inline_discussion', name='inline_discussion'),
|
||||
url(r'', 'forum_form_discussion', name='forum_form_discussion'),
|
||||
)
|
||||
|
||||
@@ -387,7 +387,8 @@ def safe_content(content):
|
||||
'updated_at', 'depth', 'type', 'commentable_id', 'comments_count',
|
||||
'at_position_list', 'children', 'highlighted_title', 'highlighted_body',
|
||||
'courseware_title', 'courseware_url', 'tags', 'unread_comments_count',
|
||||
'read', 'group_id', 'group_name', 'group_string', 'pinned', 'abuse_flaggers'
|
||||
'read', 'group_id', 'group_name', 'group_string', 'pinned', 'abuse_flaggers',
|
||||
'stats'
|
||||
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user