Browse Source

HOT-FIX: esconde campos sensiveis de protocolo na tela admin

pull/2170/head
Edward Ribeiro 7 years ago
parent
commit
c88e001451
  1. 5
      sapl/protocoloadm/admin.py
  2. 4
      sapl/utils.py

5
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'])

4
sapl/utils.py

@ -224,14 +224,14 @@ class RangeWidgetOverride(forms.MultiWidget):
return '<div class="row">%s</div>' % 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)

Loading…
Cancel
Save