Commit 3aacdf99 by David Ormsbee

Make Submission Admin page more useful by inlining student item and scores.

parent 0ba747ef
......@@ -2,6 +2,18 @@ from django.contrib import admin
from submissions.models import Score, StudentItem, Submission
class SubmissionAdmin(admin.ModelAdmin):
list_display = (
'student_item', 'attempt_number', 'submitted_at', 'created_at', 'answer',
'scores'
)
def scores(self, obj):
return ", ".join(
"{}/{}".format(score.points_earned, score.points_possible)
for score in Score.objects.filter(submission=obj.id)
)
admin.site.register(Score)
admin.site.register(StudentItem)
admin.site.register(Submission)
admin.site.register(Submission, SubmissionAdmin)
......@@ -36,6 +36,9 @@ class StudentItem(models.Model):
item_type=self.item_type,
))
def __unicode__(self):
return "({0.student_id}, {0.course_id}, {0.item_type}, {0.item_id})".format(self)
class Meta:
unique_together = (
# For integrity reasons, and looking up all of a student's items
......
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