-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4703 from open-formulieren/tool/add-script-to-fix…
…-globalconfig Add script to fix globalconfig
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python | ||
import sys | ||
from pathlib import Path | ||
|
||
import django | ||
|
||
SRC_DIR = Path(__file__).parent.parent / "src" | ||
sys.path.insert(0, str(SRC_DIR.resolve())) | ||
|
||
|
||
def main() -> None: | ||
from openforms.setup import setup_env | ||
|
||
setup_env() | ||
django.setup() | ||
|
||
from openforms.config.constants import UploadFileType | ||
from openforms.config.models import GlobalConfiguration | ||
|
||
config = GlobalConfiguration.get_solo() | ||
if "application/zip" not in config.form_upload_default_file_types: | ||
return | ||
|
||
config.form_upload_default_file_types.remove("application/zip") | ||
config.form_upload_default_file_types.append(UploadFileType.zip) | ||
config.save(update_fields=("form_upload_default_file_types",)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |