from django.apps import AppConfig
from django.contrib import admin


class NotifyConfig(AppConfig):
    default_auto_field = "django.db.models.BigAutoField"
    name = "vbv_lernwelt.notify"

    def ready(self):
        # Unregister the default Notification admin if it exists
        from vbv_lernwelt.notify.models import Notification

        # Move the admin import here to avoid early imports
        from .admin import CustomNotificationAdmin

        if admin.site.is_registered(Notification):
            admin.site.unregister(Notification)

        # Register the custom admin
        admin.site.register(Notification, CustomNotificationAdmin)
