From c88e0014518e35d01ef3cfffe122b186a1f62c04 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Fri, 24 Aug 2018 14:45:01 -0300 Subject: [PATCH] HOT-FIX: esconde campos sensiveis de protocolo na tela admin --- sapl/protocoloadm/admin.py | 5 ++++- sapl/utils.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sapl/protocoloadm/admin.py b/sapl/protocoloadm/admin.py index 5c02ebd40..c786c0faa 100644 --- a/sapl/protocoloadm/admin.py +++ b/sapl/protocoloadm/admin.py @@ -1,3 +1,6 @@ from sapl.utils import register_all_models_in_admin -register_all_models_in_admin(__name__) +register_all_models_in_admin(__name__, exclude_list=['timestamp', + 'data', + 'hora', + 'timestamp_anulacao']) diff --git a/sapl/utils.py b/sapl/utils.py index a656fa5a0..5c461f913 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -224,14 +224,14 @@ class RangeWidgetOverride(forms.MultiWidget): return '
%s
' % html -def register_all_models_in_admin(module_name): +def register_all_models_in_admin(module_name, exclude_list=[]): appname = module_name.split('.') appname = appname[1] if appname[0] == 'sapl' else appname[0] app = apps.get_app_config(appname) for model in app.get_models(): class CustomModelAdmin(CompareVersionAdmin): list_display = [f.name for f in model._meta.fields - if f.name != 'id'] + if f.name != 'id' and f.name not in exclude_list] if not admin.site.is_registered(model): admin.site.register(model, CustomModelAdmin)