Files
edx-platform/lms/djangoapps/notes/views.py
Calen Pennington cd862b3253 Merge remote-tracking branch 'edx/master' into opaque-keys
Conflicts:
	cms/djangoapps/contentstore/tests/test_contentstore.py
	cms/djangoapps/contentstore/views/component.py
	cms/djangoapps/contentstore/views/item.py
	cms/djangoapps/contentstore/views/preview.py
	cms/djangoapps/contentstore/views/tests/test_container.py
	cms/static/js/spec/views/unit_spec.js
	cms/static/js/utils/module.js
	cms/templates/container.html
	cms/templates/studio_vertical_wrapper.html
	cms/templates/studio_xblock_wrapper.html
	common/djangoapps/student/views.py
	lms/templates/notes.html
	lms/templates/textannotation.html
	lms/templates/videoannotation.html
2014-05-22 10:52:00 -04:00

31 lines
986 B
Python

from django.contrib.auth.decorators import login_required
from django.http import Http404
from edxmako.shortcuts import render_to_response
from courseware.courses import get_course_with_access
from notes.models import Note
from notes.utils import notes_enabled_for_course
from xmodule.annotator_token import retrieve_token
@login_required
def notes(request, course_id):
''' Displays the student's notes. '''
course = get_course_with_access(request.user, 'load', course_id)
if not notes_enabled_for_course(course):
raise Http404
notes = Note.objects.filter(course_id=course_id, user=request.user).order_by('-created', 'uri')
student = request.user
storage = course.annotation_storage_url
context = {
'course': course,
'notes': notes,
'student': student,
'storage': storage,
'token': retrieve_token(student.email, course.annotation_token_secret),
}
return render_to_response('notes.html', context)