-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added command to reset settings to default, removed app ready hook
renamed method, added unit tests
- Loading branch information
Showing
7 changed files
with
72 additions
and
8 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
Empty file.
Empty file.
27 changes: 27 additions & 0 deletions
27
extra_settings/management/commands/reset_extra_settings.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
Command to reset extra settings. | ||
""" | ||
|
||
import logging | ||
|
||
from django.core.management import BaseCommand | ||
from extra_settings.models import Setting | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class Command(BaseCommand): | ||
"""Django-command for refreshing extra settings to default values""" | ||
|
||
help = """ | ||
This command will remove all extra settings and recreate only those | ||
that described in `settings.EXTRA_SETTINGS_DEFAULTS`. | ||
""" | ||
|
||
def handle(self, *_, **__) -> None: | ||
""" | ||
Handle command. | ||
""" | ||
log.info("Start refreshing extra settings...") | ||
Setting.reset_to_default() | ||
log.info("Refreshing of extra settings is done.") |
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