P-259: admin testing result
This commit is contained in:
1 parent
23c433a316
commit
399236e98e
1 file changed
+9
@@ -14,10 +14,19 @@ class TestQuestionInline(nested_admin.NestedStackedInline):
|
||||
class TestAdmin(nested_admin.NestedModelAdmin):
|
||||
inlines = [TestQuestionInline]
|
||||
|
||||
class TestAttemptInline(admin.TabularInline):
|
||||
model = TestAttempt
|
||||
extra = 0 # не показывать пустые формы
|
||||
fields = ('score', 'attempt_number', 'completion_date')
|
||||
readonly_fields = ('score', 'attempt_number', 'completion_date')
|
||||
can_delete = False
|
||||
|
||||
@admin.register(Testing)
|
||||
class TestingAdmin(admin.ModelAdmin):
|
||||
# list_display = ('testing_user', 'testing_test', 'score', 'completion_date')
|
||||
list_display = ('get_user_fio', 'test', 'get_score', 'test_passed', 'completion_date')
|
||||
fields = ('user','test', 'test_passed', 'completion_date')
|
||||
inlines = [TestAttemptInline]
|
||||
|
||||
def get_user_fio(self, obj):
|
||||
return obj.user.user.fio
|
||||
|
||||
Reference in new issue
Block a user