From f669a50c02a511ab41f3efd6a69a1836c6cccf7b Mon Sep 17 00:00:00 2001 From: Michael Wedl Date: Mon, 13 Jan 2025 12:54:47 +0100 Subject: [PATCH 1/2] Fix collectstatic for pro plugins --- api/src/reportcreator_api/conf/plugins.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/api/src/reportcreator_api/conf/plugins.py b/api/src/reportcreator_api/conf/plugins.py index 9c84796a..fc02598c 100644 --- a/api/src/reportcreator_api/conf/plugins.py +++ b/api/src/reportcreator_api/conf/plugins.py @@ -16,8 +16,6 @@ from django.utils.functional import classproperty from django.utils.module_loading import module_has_submodule -from reportcreator_api.utils import license - enabled_plugins = [] @@ -147,8 +145,16 @@ def remove_entry(path: Path): def can_load_professional_plugins(): license_text = getattr(settings, 'LICENSE', config('LICENSE', default=None)) - return license.decode_and_validate_license(license=license_text, skip_db_checks=True) \ - .get('type') == license.LicenseType.PROFESSIONAL + if license.decode_and_validate_license(license=license_text, skip_db_checks=True) \ + .get('type') == license.LicenseType.PROFESSIONAL: + return True + elif len(sys.argv) >= 2 and sys.argv[0] == 'manage.py' and sys.argv[1] in [ + 'collectstatic', 'findstatic', + 'makemigrations', 'migrate', 'optimizemigrations', 'showmigrations', 'squashmigrations', 'sqlflush', 'sqlmigrate', 'sqlsequencereset', + 'check', 'spectacular', + ]: + return True + return False def collect_plugins(dst: Path, srcs: list[Path]): From 346846341e92aa1d439ca4274a9bb232e8c4b225 Mon Sep 17 00:00:00 2001 From: Michael Wedl Date: Mon, 13 Jan 2025 13:01:39 +0100 Subject: [PATCH 2/2] Fix import --- api/src/reportcreator_api/conf/plugins.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/src/reportcreator_api/conf/plugins.py b/api/src/reportcreator_api/conf/plugins.py index fc02598c..b7093112 100644 --- a/api/src/reportcreator_api/conf/plugins.py +++ b/api/src/reportcreator_api/conf/plugins.py @@ -16,6 +16,8 @@ from django.utils.functional import classproperty from django.utils.module_loading import module_has_submodule +from reportcreator_api.utils import license + enabled_plugins = []