-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: How you will learn and B2B section added for external courses
- Loading branch information
1 parent
eda16ee
commit f508324
Showing
10 changed files
with
121 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
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,36 @@ | ||
from pathlib import Path | ||
|
||
from django.core.files import File | ||
from wagtail.images.models import Image | ||
|
||
from cms.constants import B2B_SECTION, HOW_YOU_WILL_LEARN_SECTION | ||
|
||
|
||
def create_how_you_will_learn_section(): | ||
from cms.models import LearningTechniquesPage | ||
|
||
section_content = HOW_YOU_WILL_LEARN_SECTION.copy() | ||
for technique in section_content["technique_items"]: | ||
image_title = technique["value"]["heading"] | ||
with Path(technique["value"]["image"]).open("rb") as img: | ||
img_file = File(img) | ||
image, _ = Image.objects.get_or_create( | ||
title=image_title, defaults={"file": img_file} | ||
) | ||
technique["value"]["image"] = image.id | ||
|
||
return LearningTechniquesPage(**section_content) | ||
|
||
|
||
def create_b2b_section(): | ||
from cms.models import ForTeamsPage | ||
|
||
section_content = B2B_SECTION.copy() | ||
with Path(section_content["image"]).open("rb") as img: | ||
img_file = File(img) | ||
image, _ = Image.objects.get_or_create( | ||
title=section_content["title"], defaults={"file": img_file} | ||
) | ||
section_content["image"] = image | ||
|
||
return ForTeamsPage(**section_content) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.