Coverage for core/management/commands/makemigrations.py: 50%
8 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 18:35 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 18:35 +0000
1from django.conf import settings
2from django.core.management.base import CommandError
3from django.core.management.commands.makemigrations import Command as _Command
6class Command(_Command):
8 def handle(self, *args, **kwargs):
9 """
10 This built-in management command enables the creation of new database schema migration files, which should
11 never be required by and ordinary user. We prevent this command from executing unless the configuration
12 indicates that the user is a developer (i.e. configuration.DEVELOPER == True), or it was run with --check.
13 """
14 if not kwargs['check_changes'] and not settings.DEVELOPER:
15 raise CommandError(
16 "This command is available for development purposes only. It will\n"
17 "NOT resolve any issues with missing or unapplied migrations. For assistance,\n"
18 "please post to the NetBox discussion forum on GitHub:\n"
19 " https://github.com/netbox-community/netbox/discussions"
20 )
22 super().handle(*args, **kwargs)