Commit a63ae212 by David Ormsbee

Resolve settings and urls conflicts.

parents 5cad9290 29b6e2b2
from django.contrib import admin
from submissions.models import Score, StudentItem, Submission
admin.site.register(Score)
admin.site.register(StudentItem)
admin.site.register(Submission)
<h3>Submissions for {{ student_id }} > {{ course_id }} > {{ item_id }}:</h3>
{{ error }} <br/>
{{ 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 patterns, url
urlpatterns = patterns(
'submissions.views',
url(
r'^(?P<student_id>[^/]+)/(?P<course_id>[^/]+)/(?P<item_id>[^/]+)$',
'get_submissions_for_student_item'
),
)
__author__ = 'stephensanchez' import logging
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from submissions.api import SubmissionRequestError, get_submissions
log = logging.getLogger(__name__)
@login_required()
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. Renders a simple
development page with all the submissions related to the specified
student item.
"""
student_item_dict = dict(
course_id=course_id,
student_id=student_id,
item_id=item_id,
)
context = dict(**student_item_dict)
try:
submissions = get_submissions(student_item_dict)
context["submissions"] = submissions
except SubmissionRequestError:
context["error"] = "The specified student item was not found."
return render_to_response('submissions.html', context)
# Django settings for peer_grading project. # Django settings for Tim project.
import os import os
import sys import sys
...@@ -112,12 +112,10 @@ MIDDLEWARE_CLASSES = ( ...@@ -112,12 +112,10 @@ MIDDLEWARE_CLASSES = (
ROOT_URLCONF = 'urls' ROOT_URLCONF = '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 = '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 = (
......
...@@ -15,5 +15,5 @@ urlpatterns = patterns( ...@@ -15,5 +15,5 @@ urlpatterns = patterns(
url(r'^workbench/', include(workbench.urls)) url(r'^workbench/', include(workbench.urls))
# edx-tim apps # edx-tim apps
# url(r'^submissions', include(submissions.urls)), url(r'^submissions/', include(submissions.urls)),
) )
\ No newline at end of file
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