diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2020-03-04 21:27:08 +0000 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2020-03-04 21:28:41 +0000 |
commit | 00b2dd58f3e58f0d55acd3d6b36ab9de85855a25 (patch) | |
tree | 28f73d247d6b3cf17bc9572e94208e56a4175cf3 /ctrack/caf/admin.py | |
parent | e20afcf33bac3d1aadeaf37358640513219c2b07 (diff) |
improved admin list for CAFs now
Diffstat (limited to 'ctrack/caf/admin.py')
-rw-r--r-- | ctrack/caf/admin.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ctrack/caf/admin.py b/ctrack/caf/admin.py index ecdfd58..20e2b2a 100644 --- a/ctrack/caf/admin.py +++ b/ctrack/caf/admin.py @@ -14,12 +14,17 @@ class ApplicableSystemAdmin(admin.StackedInline): extra = 1 +def get_caf_name(obj): + ass = ApplicableSystem.objects.filter(caf=obj).first() + return f"{ass.organisation.name}_v{obj.version}" + + 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"] + list_display = [get_caf_name, "quality_grading", "confidence_grading", "file"] admin.site.register(CAF, CAFAdmin) |