mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #4051: Disable the makemigrations management command
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# v2.7.4 (FUTURE)
|
# v2.7.4 (FUTURE)
|
||||||
|
|
||||||
|
## Enhancements
|
||||||
|
|
||||||
|
* [#4051](https://github.com/netbox-community/netbox/issues/4051) - Disable the `makemigrations` management command
|
||||||
|
|
||||||
## Bug Fixes
|
## Bug Fixes
|
||||||
|
|
||||||
* [#4043](https://github.com/netbox-community/netbox/issues/4043) - Fix toggling of required fields in custom scripts
|
* [#4043](https://github.com/netbox-community/netbox/issues/4043) - Fix toggling of required fields in custom scripts
|
||||||
|
@@ -74,6 +74,7 @@ CORS_ORIGIN_WHITELIST = getattr(configuration, 'CORS_ORIGIN_WHITELIST', [])
|
|||||||
DATE_FORMAT = getattr(configuration, 'DATE_FORMAT', 'N j, Y')
|
DATE_FORMAT = getattr(configuration, 'DATE_FORMAT', 'N j, Y')
|
||||||
DATETIME_FORMAT = getattr(configuration, 'DATETIME_FORMAT', 'N j, Y g:i a')
|
DATETIME_FORMAT = getattr(configuration, 'DATETIME_FORMAT', 'N j, Y g:i a')
|
||||||
DEBUG = getattr(configuration, 'DEBUG', False)
|
DEBUG = getattr(configuration, 'DEBUG', False)
|
||||||
|
DEVELOPER = getattr(configuration, 'DEVELOPER', False)
|
||||||
EMAIL = getattr(configuration, 'EMAIL', {})
|
EMAIL = getattr(configuration, 'EMAIL', {})
|
||||||
ENFORCE_GLOBAL_UNIQUE = getattr(configuration, 'ENFORCE_GLOBAL_UNIQUE', False)
|
ENFORCE_GLOBAL_UNIQUE = getattr(configuration, 'ENFORCE_GLOBAL_UNIQUE', False)
|
||||||
EXEMPT_VIEW_PERMISSIONS = getattr(configuration, 'EXEMPT_VIEW_PERMISSIONS', [])
|
EXEMPT_VIEW_PERMISSIONS = getattr(configuration, 'EXEMPT_VIEW_PERMISSIONS', [])
|
||||||
|
@@ -1,7 +1,28 @@
|
|||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
from django.core.management.commands.makemigrations import Command
|
from django.conf import settings
|
||||||
|
from django.core.management.base import CommandError
|
||||||
|
from django.core.management.commands.makemigrations import Command as _Command
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from . import custom_deconstruct
|
from . import custom_deconstruct
|
||||||
|
|
||||||
models.Field.deconstruct = custom_deconstruct
|
models.Field.deconstruct = custom_deconstruct
|
||||||
|
|
||||||
|
|
||||||
|
class Command(_Command):
|
||||||
|
|
||||||
|
def handle(self, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
This built-in management command enables the creation of new database schema migration files, which should
|
||||||
|
never be required by and ordinary user. We prevent this command from executing unless the configuration
|
||||||
|
indicates that the user is a developer (i.e. configuration.DEVELOPER == True).
|
||||||
|
"""
|
||||||
|
if not settings.DEVELOPER:
|
||||||
|
raise CommandError(
|
||||||
|
"This command is available for development purposes only. It will\n"
|
||||||
|
"NOT resolve any issues with missing or unapplied migrations. For assistance,\n"
|
||||||
|
"please post to the NetBox mailing list:\n"
|
||||||
|
" https://groups.google.com/forum/#!forum/netbox-discuss"
|
||||||
|
)
|
||||||
|
|
||||||
|
super().handle(*args, **kwargs)
|
||||||
|
Reference in New Issue
Block a user