Commit d10282c9 by David Ormsbee

Merge pull request #32 from edx/submissions_listing

Make Submission Admin page more useful by inlining student item and scores
parents 0ba747ef 3aacdf99
...@@ -2,6 +2,18 @@ from django.contrib import admin ...@@ -2,6 +2,18 @@ from django.contrib import admin
from submissions.models import Score, StudentItem, Submission 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(Score)
admin.site.register(StudentItem) admin.site.register(StudentItem)
admin.site.register(Submission) admin.site.register(Submission, SubmissionAdmin)
...@@ -36,6 +36,9 @@ class StudentItem(models.Model): ...@@ -36,6 +36,9 @@ class StudentItem(models.Model):
item_type=self.item_type, 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: class Meta:
unique_together = ( unique_together = (
# For integrity reasons, and looking up all of a student's items # 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