aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/caf/admin.py
blob: ecdfd58e02e3784d8a880d4cc686c94a43ca28e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from django.contrib import admin

from .models import CAF, FileStore, DocumentFile, Grading, ApplicableSystem


class ApplicableSystemListAdmin(admin.ModelAdmin):
    model = ApplicableSystem
    list_display = ["name", "organisation", "caf"]


class ApplicableSystemAdmin(admin.StackedInline):
    model = ApplicableSystem
    max_num = 3
    extra = 1


class CAFAdmin(admin.ModelAdmin):
    # TODO - we need the CAF list to show essential services
    #  but this is a many-to-many relationship, so we need to summarise it somehow
    model = CAF
    inlines = [ApplicableSystemAdmin]
    list_display = ["quality_grading", "confidence_grading", "file"]


admin.site.register(CAF, CAFAdmin)
admin.site.register(FileStore)
admin.site.register(DocumentFile)
admin.site.register(Grading)
admin.site.register(ApplicableSystem, ApplicableSystemListAdmin)