Skip to content

Commit 8fd23a3

Browse files
committed
[fix] Prevent fallback fields from generating migrations #1231
No DB migrations should be created when default settings are changed. Defined constants FALLBACK_WHOIS_ENABLED and FALLBACK_ESTIMATED_LOCATION_ENABLED in multitenancy.py to hold default values, preventing migration churn when app settings are modified. Fixes #1231
1 parent c266e80 commit 8fd23a3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

openwisp_controller/config/base/multitenancy.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
from ..exceptions import OrganizationDeviceLimitExceeded
1515
from ..tasks import bulk_invalidate_config_get_cached_checksum
1616

17+
FALLBACK_WHOIS_ENABLED = False
18+
FALLBACK_ESTIMATED_LOCATION_ENABLED = False
19+
1720

1821
class AbstractOrganizationConfigSettings(UUIDModel):
1922
organization = models.OneToOneField(
@@ -36,12 +39,12 @@ class AbstractOrganizationConfigSettings(UUIDModel):
3639
)
3740
whois_enabled = FallbackBooleanChoiceField(
3841
help_text=_("Whether the WHOIS lookup feature is enabled"),
39-
fallback=app_settings.WHOIS_ENABLED,
42+
fallback=FALLBACK_WHOIS_ENABLED,
4043
verbose_name=_("WHOIS Enabled"),
4144
)
4245
estimated_location_enabled = FallbackBooleanChoiceField(
4346
help_text=_("Whether the estimated location feature is enabled"),
44-
fallback=app_settings.ESTIMATED_LOCATION_ENABLED,
47+
fallback=FALLBACK_ESTIMATED_LOCATION_ENABLED,
4548
verbose_name=_("Estimated Location Enabled"),
4649
)
4750
context = JSONField(

0 commit comments

Comments
 (0)