瀏覽代碼

#14872: Permit makemigrations --check without setting DEVELOPER=True

Jeremy Stretch 2 年之前
父節點
當前提交
1651a307c8
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      netbox/core/management/commands/makemigrations.py

+ 2 - 2
netbox/core/management/commands/makemigrations.py

@@ -9,9 +9,9 @@ class Command(_Command):
         """
         """
         This built-in management command enables the creation of new database schema migration files, which should
         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
         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).
+        indicates that the user is a developer (i.e. configuration.DEVELOPER == True), or it was run with --check.
         """
         """
-        if not settings.DEVELOPER:
+        if not kwargs['check_changes'] and not settings.DEVELOPER:
             raise CommandError(
             raise CommandError(
                 "This command is available for development purposes only. It will\n"
                 "This command is available for development purposes only. It will\n"
                 "NOT resolve any issues with missing or unapplied migrations. For assistance,\n"
                 "NOT resolve any issues with missing or unapplied migrations. For assistance,\n"