13 lines
332 B
Python
13 lines
332 B
Python
from django.apps import apps
|
|
from django.conf import settings
|
|
from django.contrib import admin
|
|
from django.contrib.admin.sites import AlreadyRegistered
|
|
|
|
if settings.DEBUG:
|
|
models = apps.get_models()
|
|
|
|
for model in models:
|
|
try:
|
|
admin.site.register(model)
|
|
except AlreadyRegistered:
|
|
pass
|