Browse Source

List all fields by default in admin

pull/6/head
Marcio Mazza 10 years ago
parent
commit
938bd5b108
  1. 8
      base/admin.py
  2. 8
      comissoes/admin.py
  3. 8
      lexml/admin.py
  4. 8
      materia/admin.py
  5. 8
      norma/admin.py
  6. 8
      parlamentares/admin.py
  7. 8
      protocoloadm/admin.py
  8. 8
      sessao/admin.py

8
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)

8
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)

8
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)

8
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)

8
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)

8
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)

8
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)

8
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)

Loading…
Cancel
Save