from django.apps import apps as _apps
from django.contrib import admin
from django.contrib.admin.sites import AlreadyRegistered

# Register your models here.

apps = [
    'main',
    'administration',
    'league',
    'calendar',
    'gpb',
    'tournaments',
    'membership',
    'atu',
    'core'
]

for app in [app for name, app in _apps.app_configs.items() if name in apps]:
    app_models = app.get_models()
    for model in app_models:
        try:
            admin.site.register(model)
        except AlreadyRegistered:
            pass


admin.site.site_header = 'pdlzbs'
admin.site.site_title = 'pdlzbs'
admin.site.index_title = 'Panel administracyjny'
admin.site.site_url = '/'
admin.site.enable_nav_sidebar = False
