-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
30 additions
and
0 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 |
---|---|---|
|
@@ -146,4 +146,5 @@ dmypy.json | |
.vscode/ | ||
|
||
# Project-specific stuff | ||
config.json | ||
cron.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"header_brand": "Intitulé officiel", | ||
"header_brand_html": "Intitulé<br />officiel", | ||
"footer_brand": "Intitulé officiel", | ||
"footer_brand_html": "Intitulé<br />officiel", | ||
"site_title": "Titre du site", | ||
"site_tagline": "Sous-titre du site", | ||
"footer_description": "Description" | ||
} |
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,19 @@ | ||
import json | ||
from os.path import isfile | ||
|
||
from django.core.management.base import BaseCommand | ||
|
||
from content_manager.models import CmsDsfrConfig | ||
|
||
|
||
class Command(BaseCommand): | ||
def handle(self, *args, **kwargs): | ||
if isfile("config.json"): | ||
with open("config.json") as config_file: | ||
config_data = json.load(config_file) | ||
|
||
_config, created = CmsDsfrConfig.objects.get_or_create(id=1, defaults=config_data) | ||
if created: | ||
self.stdout.write(self.style.SUCCESS(f"Config imported for {config_data.get('site_title', '')}")) | ||
else: | ||
self.stdout.write(self.style.SUCCESS("Config already existing, data not imported.")) |