2016-01-31 16:17:37 +01:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2016-03-05 13:14:33 +01:00
|
|
|
from tkupek_elearning.elearning.models import Option, Setting, Question, UserAnswer, User
|
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,
|
|
|
|
]
|
|
|
|
|
2016-02-09 21:46:52 +01:00
|
|
|
|
|
|
|
class UserAnswerInline(admin.TabularInline):
|
|
|
|
model = UserAnswer
|
|
|
|
|
|
|
|
|
|
|
|
class UserAdmin(admin.ModelAdmin):
|
|
|
|
inlines = [
|
|
|
|
UserAnswerInline,
|
|
|
|
]
|
|
|
|
|
2016-03-05 11:40:40 +01:00
|
|
|
def get_readonly_fields(self, request, obj=None):
|
|
|
|
|
2016-03-05 15:12:53 +01:00
|
|
|
return self.readonly_fields + ('token', 'last_seen', 'completed')
|
2016-03-05 11:40:40 +01:00
|
|
|
|
|
|
|
|
2016-03-05 13:31:42 +01:00
|
|
|
class SettingAdmin(admin.ModelAdmin):
|
|
|
|
def get_readonly_fields(self, request, obj=None):
|
|
|
|
|
|
|
|
return self.readonly_fields + ('statistic_token',)
|
|
|
|
|
2016-01-31 18:19:45 +01:00
|
|
|
admin.site.register(Question, QuestionAdmin)
|
2016-03-05 13:31:42 +01:00
|
|
|
admin.site.register(Setting, SettingAdmin),
|
2016-02-21 22:41:24 +01:00
|
|
|
admin.site.register(User, UserAdmin)
|