Commit 2df8581c by Stephen Sanchez

First pass at a submissions dev view

parent d066182f
<h3>Submissions for {{ student_id }} > {{ course_id }} > {{ item_id }}:</h3>
{{ submissions|length }} total submissions. <br/>
<br/>
<table border=1>
<th>Student Item</th>
<th>Attempt Number</th>
<th>Answer</th>
<th>Submitted At</th>
<th>Created At</th>
{% for submission in submissions%}
<tr>
<td>{{ submission.student_item }}</td>
<td>{{ submission.attempt_number }}</td>
<td>{{ submission.answer }}</td>
<td>{{ submission.submitted_at }}</td>
<td>{{ submission.created_at }}</td>
</tr>
{% endfor %}
</table>
from django.conf.urls import url, patterns
urlpatterns = patterns('submissions.views',
url(r'^submissions/(?P<student_id>[^/]+)/(?P<course_id>[^/]+)/(?P<item_id>[^/]+)$',
'get_submissions_for_student_item'),
)
__author__ = 'stephensanchez' import logging
from django.shortcuts import render_to_response
from submissions import api
log = logging.getLogger(__name__)
def get_submissions_for_student_item(request, course_id, student_id, item_id):
"""Retrieve all submissions associated with the given student item.
Developer utility for accessing all the submissions associated with a
student item. The student item is specified by the unique combination of
course, student, and item.
Args:
request (dict): The request.
course_id (str): The course id for this student item.
student_id (str): The student id for this student item.
item_id (str): The item id for this student item.
Returns:
HttpResponse: The response object for this request.
"""
student_item_dict = dict(
course_id=course_id,
student_id=student_id,
item_id=item_id,
)
submissions = api.get_submissions(student_item_dict)
context = dict(
submissions=submissions,
**student_item_dict
)
return render_to_response('submissions.html', context)
...@@ -22,11 +22,11 @@ import sys, os ...@@ -22,11 +22,11 @@ import sys, os
# If your documentation needs a minimal Sphinx version, state it here. # If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0' #needs_sphinx = '1.0'
root = os.path.abspath('../..') root = os.path.abspath('../../apps')
sys.path.append(root) sys.path.append(root)
sys.path.append(os.path.join(root, "common_grading")) sys.path.append(os.path.join(root, "submissions"))
sys.path.append(os.path.join(root, "peer_grading")) sys.path.append(os.path.join(root, "openassessment/peer"))
# Add any Sphinx extension module names here, as strings. They can be extensions # Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
......
# Django settings for peer_grading project. # Django settings for Tim project.
import os import os
import sys import sys
...@@ -109,15 +109,13 @@ MIDDLEWARE_CLASSES = ( ...@@ -109,15 +109,13 @@ MIDDLEWARE_CLASSES = (
# 'django.middleware.clickjacking.XFrameOptionsMiddleware', # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
) )
ROOT_URLCONF = 'common_grading.urls' ROOT_URLCONF = 'submissions.urls'
# Python dotted path to the WSGI application used by Django's runserver. # Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'peer_grading.wsgi.application' # WSGI_APPLICATION = 'submissions.wsgi.application'
TEMPLATE_DIRS = ( TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". "apps/submissions/templates",
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
) )
INSTALLED_APPS = ( INSTALLED_APPS = (
......
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