BaseCommand.leave_locale_alone
A boolean indicating whether the locale set in settings should be preserved during the execution of the command instead of being forcibly set to ‘en-us’.
Default value is False
.
Make sure you know what you are doing if you decide to change the value of this option in your custom command if it creates database content that is locale-sensitive and such content shouldn’t contain any translations (like it happens e.g. with django.contrib.auth permissions) as making the locale differ from the de facto default ‘en-us’ might cause unintended effects. Seethe Management commands and locales section above for further details.
This option can’t be False
when the can_import_settings
option is set to False
too because attempting to set the locale needs access to settings. This condition will generate a CommandError
.
Please login to continue.