diff --git a/onlinecourse/admin.py b/onlinecourse/admin.py index ffd8a631d..a36d79609 100644 --- a/onlinecourse/admin.py +++ b/onlinecourse/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin # Import any new Models here -from .models import Course, Lesson, Instructor, Learner +from .models import Course, Lesson, Instructor, Learner, Question, Choice, Submission # Register QuestionInline and ChoiceInline classes here @@ -10,21 +10,43 @@ class LessonInline(admin.StackedInline): extra = 5 +class QuestionInline(admin.StackedInline): + model = Question + extra = 5 + + +class ChoiceInline(admin.StackedInline): + model = Choice + extra = 5 + + # Register your models here. class CourseAdmin(admin.ModelAdmin): - inlines = [LessonInline] + inlines = [LessonInline, QuestionInline] list_display = ('name', 'pub_date') list_filter = ['pub_date'] search_fields = ['name', 'description'] class LessonAdmin(admin.ModelAdmin): + inlines = [QuestionInline] list_display = ['title'] +class QuestionAdmin(admin.ModelAdmin): + inlines = [ChoiceInline] + list_display = ['text'] + + +class ChoiceAdmin(admin.ModelAdmin): + list_display = ['choice_text', 'is_correct'] + + # Register Question and Choice models here admin.site.register(Course, CourseAdmin) admin.site.register(Lesson, LessonAdmin) admin.site.register(Instructor) admin.site.register(Learner) +admin.site.register(Question, QuestionAdmin) +admin.site.register(Choice, ChoiceAdmin)