forked from openedx/credentials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [ACI-262] credly_badges feature flag
- Loading branch information
1 parent
2d09429
commit a40642c
Showing
3 changed files
with
45 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
""" | ||
Admin section configuration for credly badges. | ||
""" | ||
|
||
from .toggles import is_credly_badges_enabled | ||
|
||
if is_credly_badges_enabled(): | ||
# TODO: Define registering admin classes here `admin.site.register(...)` | ||
pass |
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
31 changes: 30 additions & 1 deletion
31
credentials/apps/badges/distribution/credly_badges/toggles.py
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 |
---|---|---|
@@ -1,3 +1,32 @@ | ||
""" | ||
Toggles for credly badges app. | ||
""" | ||
""" | ||
|
||
from edx_toggles.toggles import SettingToggle | ||
|
||
# .. toggle_name: CREDLY_BADGES_ENABLED | ||
# .. toggle_implementation: DjangoSetting | ||
# .. toggle_default: False | ||
# .. toggle_description: Determines if the Credentials IDA uses credly badges functionality. | ||
# .. toggle_life_expectancy: permanent | ||
# .. toggle_permanent_justification: Credly badges are optional for usage. | ||
# .. toggle_creation_date: 2024-01-16 | ||
# .. toggle_use_cases: open_edx | ||
ENABLE_CREDLY_BADGES = SettingToggle('CREDLY_BADGES_ENABLED', default=False, module_name=__name__) | ||
|
||
|
||
def is_credly_badges_enabled(): | ||
""" | ||
Checks if credly badges app enabled. | ||
""" | ||
return ENABLE_CREDLY_BADGES.is_enabled() | ||
|
||
|
||
def check_credly_badges_enabled(func): | ||
""" | ||
Decorator for checking the applicability of a credly badges app. | ||
""" | ||
def wrapper(*args, **kwargs): | ||
if is_credly_badges_enabled(): | ||
return func(*args, **kwargs) | ||
return wrapper |