diff --git a/base/admin.py b/base/admin.py index 9daaf8098..17d47f4c6 100644 --- a/base/admin.py +++ b/base/admin.py @@ -1,9 +1,11 @@ from django.apps import apps from django.contrib import admin - appname = __name__.split('.')[0] app = apps.get_app_config(appname) - for model in app.get_models(): - admin.site.register(model) + class CustomModelAdmin(admin.ModelAdmin): + list_display = [f.name for f in model._meta.fields if f.name != 'id'] + + if not admin.site.is_registered(model): + admin.site.register(model, CustomModelAdmin) diff --git a/comissoes/admin.py b/comissoes/admin.py index 9daaf8098..17d47f4c6 100644 --- a/comissoes/admin.py +++ b/comissoes/admin.py @@ -1,9 +1,11 @@ from django.apps import apps from django.contrib import admin - appname = __name__.split('.')[0] app = apps.get_app_config(appname) - for model in app.get_models(): - admin.site.register(model) + class CustomModelAdmin(admin.ModelAdmin): + list_display = [f.name for f in model._meta.fields if f.name != 'id'] + + if not admin.site.is_registered(model): + admin.site.register(model, CustomModelAdmin) diff --git a/lexml/admin.py b/lexml/admin.py index 9daaf8098..17d47f4c6 100644 --- a/lexml/admin.py +++ b/lexml/admin.py @@ -1,9 +1,11 @@ from django.apps import apps from django.contrib import admin - appname = __name__.split('.')[0] app = apps.get_app_config(appname) - for model in app.get_models(): - admin.site.register(model) + class CustomModelAdmin(admin.ModelAdmin): + list_display = [f.name for f in model._meta.fields if f.name != 'id'] + + if not admin.site.is_registered(model): + admin.site.register(model, CustomModelAdmin) diff --git a/materia/admin.py b/materia/admin.py index 9daaf8098..17d47f4c6 100644 --- a/materia/admin.py +++ b/materia/admin.py @@ -1,9 +1,11 @@ from django.apps import apps from django.contrib import admin - appname = __name__.split('.')[0] app = apps.get_app_config(appname) - for model in app.get_models(): - admin.site.register(model) + class CustomModelAdmin(admin.ModelAdmin): + list_display = [f.name for f in model._meta.fields if f.name != 'id'] + + if not admin.site.is_registered(model): + admin.site.register(model, CustomModelAdmin) diff --git a/norma/admin.py b/norma/admin.py index 9daaf8098..17d47f4c6 100644 --- a/norma/admin.py +++ b/norma/admin.py @@ -1,9 +1,11 @@ from django.apps import apps from django.contrib import admin - appname = __name__.split('.')[0] app = apps.get_app_config(appname) - for model in app.get_models(): - admin.site.register(model) + class CustomModelAdmin(admin.ModelAdmin): + list_display = [f.name for f in model._meta.fields if f.name != 'id'] + + if not admin.site.is_registered(model): + admin.site.register(model, CustomModelAdmin) diff --git a/parlamentares/admin.py b/parlamentares/admin.py index 9daaf8098..17d47f4c6 100644 --- a/parlamentares/admin.py +++ b/parlamentares/admin.py @@ -1,9 +1,11 @@ from django.apps import apps from django.contrib import admin - appname = __name__.split('.')[0] app = apps.get_app_config(appname) - for model in app.get_models(): - admin.site.register(model) + class CustomModelAdmin(admin.ModelAdmin): + list_display = [f.name for f in model._meta.fields if f.name != 'id'] + + if not admin.site.is_registered(model): + admin.site.register(model, CustomModelAdmin) diff --git a/protocoloadm/admin.py b/protocoloadm/admin.py index 9daaf8098..17d47f4c6 100644 --- a/protocoloadm/admin.py +++ b/protocoloadm/admin.py @@ -1,9 +1,11 @@ from django.apps import apps from django.contrib import admin - appname = __name__.split('.')[0] app = apps.get_app_config(appname) - for model in app.get_models(): - admin.site.register(model) + class CustomModelAdmin(admin.ModelAdmin): + list_display = [f.name for f in model._meta.fields if f.name != 'id'] + + if not admin.site.is_registered(model): + admin.site.register(model, CustomModelAdmin) diff --git a/sessao/admin.py b/sessao/admin.py index 9daaf8098..17d47f4c6 100644 --- a/sessao/admin.py +++ b/sessao/admin.py @@ -1,9 +1,11 @@ from django.apps import apps from django.contrib import admin - appname = __name__.split('.')[0] app = apps.get_app_config(appname) - for model in app.get_models(): - admin.site.register(model) + class CustomModelAdmin(admin.ModelAdmin): + list_display = [f.name for f in model._meta.fields if f.name != 'id'] + + if not admin.site.is_registered(model): + admin.site.register(model, CustomModelAdmin)