From 644baaf5963ee496f4aeb9862d3a3ecd59ed1974 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Tue, 7 May 2019 10:01:45 +1200 Subject: [PATCH] admin: allow editing ClassicRecipe fields There's no particular reason these fields should be read-only (unlike the fields picked up from Recipe, they aren't derived from the recipe itself.) Signed-off-by: Paul Eggleton --- layerindex/admin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layerindex/admin.py b/layerindex/admin.py index 5fbd2b4..b89ef56 100644 --- a/layerindex/admin.py +++ b/layerindex/admin.py @@ -122,9 +122,10 @@ class ClassicRecipeAdmin(admin.ModelAdmin): search_fields = ['filename', 'pn', 'cover_pn'] list_filter = ['layerbranch__layer__name', 'layerbranch__branch__name'] def get_readonly_fields(self, request, obj=None): + rwfields = ['cover_layerbranch', 'cover_pn', 'cover_status', 'cover_verified', 'cover_comment', 'classic_category', 'needs_attention', 'sha256sum', 'export'] rofields = [] for f in ClassicRecipe._meta.get_fields(): - if not (f.auto_created and f.is_relation): + if f.name not in rwfields and not (f.auto_created and f.is_relation): rofields.append(f.name) return rofields def has_add_permission(self, request, obj=None):