mirror of https://github.com/interlegis/sapl.git
Marcio Mazza
10 years ago
9 changed files with 29 additions and 72 deletions
@ -1,11 +1,4 @@ |
|||||
from django.apps import apps |
from sapl.utils import register_all_models_in_admin |
||||
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): |
register_all_models_in_admin(__name__) |
||||
admin.site.register(model, CustomModelAdmin) |
|
||||
|
@ -1,11 +1,4 @@ |
|||||
from django.apps import apps |
from sapl.utils import register_all_models_in_admin |
||||
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): |
register_all_models_in_admin(__name__) |
||||
admin.site.register(model, CustomModelAdmin) |
|
||||
|
@ -1,11 +1,4 @@ |
|||||
from django.apps import apps |
from sapl.utils import register_all_models_in_admin |
||||
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): |
register_all_models_in_admin(__name__) |
||||
admin.site.register(model, CustomModelAdmin) |
|
||||
|
@ -1,11 +1,4 @@ |
|||||
from django.apps import apps |
from sapl.utils import register_all_models_in_admin |
||||
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): |
register_all_models_in_admin(__name__) |
||||
admin.site.register(model, CustomModelAdmin) |
|
||||
|
@ -1,11 +1,4 @@ |
|||||
from django.apps import apps |
from sapl.utils import register_all_models_in_admin |
||||
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): |
register_all_models_in_admin(__name__) |
||||
admin.site.register(model, CustomModelAdmin) |
|
||||
|
@ -1,11 +1,4 @@ |
|||||
from django.apps import apps |
from sapl.utils import register_all_models_in_admin |
||||
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): |
register_all_models_in_admin(__name__) |
||||
admin.site.register(model, CustomModelAdmin) |
|
||||
|
@ -1,11 +1,4 @@ |
|||||
from django.apps import apps |
from sapl.utils import register_all_models_in_admin |
||||
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): |
register_all_models_in_admin(__name__) |
||||
admin.site.register(model, CustomModelAdmin) |
|
||||
|
@ -0,0 +1,13 @@ |
|||||
|
from django.apps import apps |
||||
|
from django.contrib import admin |
||||
|
|
||||
|
|
||||
|
def register_all_models_in_admin(module_name): |
||||
|
appname = module_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) |
@ -1,11 +1,4 @@ |
|||||
from django.apps import apps |
from sapl.utils import register_all_models_in_admin |
||||
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): |
register_all_models_in_admin(__name__) |
||||
admin.site.register(model, CustomModelAdmin) |
|
||||
|
Loading…
Reference in new issue