vcp-elearning/tkupek_elearning/elearning/admin.py

33 lines
676 B
Python
Raw Normal View History

2016-01-31 16:17:37 +01:00
from django.contrib import admin
from tkupek_elearning.elearning.models import Option, Setting, Question, UserAnswer, User, UserAnswerOptions
2016-01-31 16:17:37 +01:00
2016-01-31 18:19:45 +01:00
class OptionInline(admin.TabularInline):
model = Option
class QuestionAdmin(admin.ModelAdmin):
inlines = [
OptionInline,
]
class UserAnswerInline(admin.TabularInline):
model = UserAnswer
class UserAdmin(admin.ModelAdmin):
inlines = [
UserAnswerInline,
]
def get_readonly_fields(self, request, obj=None):
return self.readonly_fields + ('token', 'last_seen')
2016-01-31 18:19:45 +01:00
admin.site.register(Question, QuestionAdmin)
2016-02-09 19:51:05 +01:00
admin.site.register(Setting),
admin.site.register(User, UserAdmin)