from django.contrib import admin from .models import Questionnaire, QuestionnaireTopic, QuestionnaireQuestion, QuestionnaireResponse, QuestionnaireStorage # Register your models here. @admin.register(Questionnaire) class QuestionnaireAdmin(admin.ModelAdmin): list_display = ('name', 'id',) readonly_fields = ('created_at', 'updated_at') @admin.register(QuestionnaireTopic) class QuestionnaireTopicAdmin(admin.ModelAdmin): list_display = ('name', 'order', 'questionnaire',) ordering = ('order', ) readonly_fields = ('created_at', 'updated_at') @admin.register(QuestionnaireQuestion) class QuestionnaireQuestionAdmin(admin.ModelAdmin): list_display = ('name', 'order', 'type', 'topic', 'questionnaire') ordering = ('order', ) readonly_fields = ('created_at', 'updated_at') def questionnaire(self, item): return item.topic.questionnaire @admin.register(QuestionnaireResponse) class QuestionnaireResponseAdmin(admin.ModelAdmin): list_display = ('id', 'created_at', 'questionnaire') ordering = ('-created_at', ) readonly_fields = ('questionnaire','response','created_at', 'updated_at') @admin.register(QuestionnaireStorage) class QuestionnaireStorageAdmin(admin.ModelAdmin): list_display = ('name', 'type', 'server') ordering = ('name', ) readonly_fields = ('created_at', 'updated_at')