netbox/netbox/core/apps.py
Jeremy Stretch 1b753ed5bc Closes #17725: Clean up import statements (#17728)
* #17725: Resolve all F401 errors

* Tweak noqa designation
2024-10-10 14:52:47 -04:00

25 lines
849 B
Python

from django.apps import AppConfig
from django.db import models
from django.db.migrations.operations import AlterModelOptions
from utilities.migration import custom_deconstruct
# Ignore verbose_name & verbose_name_plural Meta options when calculating model migrations
AlterModelOptions.ALTER_OPTION_KEYS.remove('verbose_name')
AlterModelOptions.ALTER_OPTION_KEYS.remove('verbose_name_plural')
# Use our custom destructor to ignore certain attributes when calculating field migrations
models.Field.deconstruct = custom_deconstruct
class CoreConfig(AppConfig):
name = "core"
def ready(self):
from core.api import schema # noqa: F401
from netbox.models.features import register_models
from . import data_backends, events, search # noqa: F401
# Register models
register_models(*self.get_models())