Sistema de Apoio ao Processo Legislativo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
384 B

from django.apps import apps
10 years ago
from django.contrib import admin
appname = __name__.split('.')[0]
app = apps.get_app_config(appname)
for model in app.get_models():
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)