Skip to content

Commit 129fe2c

Browse files
committed
add CREATE_DEPENDENCIES_DEFAULT setting
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 5f29f2b commit 129fe2c

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

dejacode/settings.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,11 @@ def get_fake_redis_connection(config, use_strict_redis):
586586
"propagate": False,
587587
"level": DEJACODE_LOG_LEVEL,
588588
},
589+
"product_portfolio": {
590+
"handlers": ["null"] if IS_TESTS else ["console"],
591+
"propagate": False,
592+
"level": "DEBUG" if DEBUG else DEJACODE_LOG_LEVEL,
593+
},
589594
},
590595
}
591596

@@ -717,6 +722,7 @@ def get_fake_redis_connection(config, use_strict_redis):
717722

718723
# Default to 5 seconds.
719724
DEJACODE_INTEGRATION_REQUESTS_TIMEOUT = env.int("DEJACODE_INTEGRATION_REQUESTS_TIMEOUT", default=5)
725+
CREATE_DEPENDENCIES_DEFAULT = env.bool("CREATE_DEPENDENCIES_DEFAULT", default=True)
720726

721727
if IS_TESTS:
722728
# Silent the django-axes logging during tests

product_portfolio/forms.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import json
1010

1111
from django import forms
12+
from django.conf import settings
1213
from django.core.exceptions import ValidationError
1314
from django.db import transaction
1415
from django.forms import BaseModelFormSet
@@ -557,7 +558,7 @@ class ImportFromScanForm(forms.Form):
557558
create_dependencies = forms.BooleanField(
558559
label=_("Create Dependencies"),
559560
required=False,
560-
initial=False,
561+
initial=settings.CREATE_DEPENDENCIES_DEFAULT,
561562
help_text=_(
562563
"When checked, dependency relationships between packages discovered in the "
563564
"import will be created on the Product."
@@ -664,7 +665,7 @@ class BaseProductImportFormView(forms.Form):
664665
create_dependencies = forms.BooleanField(
665666
label=_("Create Dependencies"),
666667
required=False,
667-
initial=False,
668+
initial=settings.CREATE_DEPENDENCIES_DEFAULT,
668669
help_text=_(
669670
"When checked, dependency relationships between packages discovered in the "
670671
"import will be created on the Product."
@@ -1002,7 +1003,7 @@ class PullProjectDataForm(forms.Form):
10021003
create_dependencies = forms.BooleanField(
10031004
label=_("Create Dependencies"),
10041005
required=False,
1005-
initial=False,
1006+
initial=settings.CREATE_DEPENDENCIES_DEFAULT,
10061007
help_text=_(
10071008
"When checked, dependency relationships between packages discovered in the "
10081009
"import will be created on the Product."

0 commit comments

Comments
 (0)