From 00b2dd58f3e58f0d55acd3d6b36ab9de85855a25 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Wed, 4 Mar 2020 21:27:08 +0000 Subject: improved admin list for CAFs now --- ctrack/caf/admin.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ctrack/caf/admin.py') 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) -- cgit v1.2.3