2021-06-27 13:44:01 +02:00
|
|
|
from django.apps import apps
|
|
|
|
from django.conf import settings
|
|
|
|
from django.contrib import admin
|
2024-07-09 08:46:06 +02:00
|
|
|
from django.contrib.admin.sites import AlreadyRegistered
|
2021-06-27 13:44:01 +02:00
|
|
|
|
|
|
|
if settings.DEBUG:
|
|
|
|
models = apps.get_models()
|
|
|
|
|
|
|
|
for model in models:
|
|
|
|
try:
|
|
|
|
admin.site.register(model)
|
2024-07-09 08:46:06 +02:00
|
|
|
except AlreadyRegistered:
|
2021-06-27 13:44:01 +02:00
|
|
|
pass
|