Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 13, 2024
1 parent 81bc6ae commit af8e137
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 16 deletions.
1 change: 1 addition & 0 deletions cms/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class CustomTabBlock(blocks.StructBlock):
"""
A Custom tab on course page
"""

title = blocks.CharBlock(
max_length=50,
help="Displayed as the tab name",
Expand Down
28 changes: 22 additions & 6 deletions cms/migrations/0043_coursepage_custom_tab.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
# Generated by Django 4.2.16 on 2024-12-11 16:36

from django.db import migrations
import wagtail.fields
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('cms', '0042_populate_weekly_hours'),
("cms", "0042_populate_weekly_hours"),
]

operations = [
migrations.AddField(
model_name='coursepage',
name='custom_tab',
field=wagtail.fields.StreamField([('custom_tab', 2)], blank=True, block_lookup={0: ('wagtail.blocks.CharBlock', (), {'help': 'Displayed as the tab name', 'max_length': 50}), 1: ('wagtail.blocks.RichTextBlock', (), {}), 2: ('wagtail.blocks.StructBlock', [[('title', 0), ('content', 1)]], {})}, help_text='This is the custom tab for this course.'),
model_name="coursepage",
name="custom_tab",
field=wagtail.fields.StreamField(
[("custom_tab", 2)],
blank=True,
block_lookup={
0: (
"wagtail.blocks.CharBlock",
(),
{"help": "Displayed as the tab name", "max_length": 50},
),
1: ("wagtail.blocks.RichTextBlock", (), {}),
2: (
"wagtail.blocks.StructBlock",
[[("title", 0), ("content", 1)]],
{},
),
},
help_text="This is the custom tab for this course.",
),
),
]
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
# Generated by Django 4.2.16 on 2024-12-12 19:43

from django.db import migrations
import wagtail.fields
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('cms', '0043_coursepage_custom_tab'),
("cms", "0043_coursepage_custom_tab"),
]

operations = [
migrations.RemoveField(
model_name='coursepage',
name='custom_tab',
model_name="coursepage",
name="custom_tab",
),
migrations.AddField(
model_name='coursepage',
name='custom_tabs',
field=wagtail.fields.StreamField([('custom_tab', 3)], blank=True, block_lookup={0: ('wagtail.blocks.CharBlock', (), {'help': 'Displayed as the tab name', 'max_length': 50}), 1: ('wagtail.blocks.CharBlock', (), {'help': 'id of this element for scrolling on the page. One word or more connected with a dash.'}), 2: ('wagtail.blocks.RichTextBlock', (), {}), 3: ('wagtail.blocks.StructBlock', [[('title', 0), ('href_slug', 1), ('content', 2)]], {})}, help_text='This is the custom tab for this course.'),
model_name="coursepage",
name="custom_tabs",
field=wagtail.fields.StreamField(
[("custom_tab", 3)],
blank=True,
block_lookup={
0: (
"wagtail.blocks.CharBlock",
(),
{"help": "Displayed as the tab name", "max_length": 50},
),
1: (
"wagtail.blocks.CharBlock",
(),
{
"help": "id of this element for scrolling on the page. One word or more connected with a dash."
},
),
2: ("wagtail.blocks.RichTextBlock", (), {}),
3: (
"wagtail.blocks.StructBlock",
[[("title", 0), ("href_slug", 1), ("content", 2)]],
{},
),
},
help_text="This is the custom tab for this course.",
),
),
]
4 changes: 2 additions & 2 deletions cms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@

from cms.blocks import (
CourseRunCertificateOverrides,
CustomTabBlock,
PriceBlock,
ResourceBlock,
CustomTabBlock,
validate_unique_readable_ids,
)
from cms.constants import (
Expand Down Expand Up @@ -1252,7 +1252,7 @@ def get_context(self, request, *args, **kwargs):
{
"title": tab.value["title"],
"slug": tab.value["href_slug"],
"content": tab.value["content"]
"content": tab.value["content"],
}
)
return {
Expand Down

0 comments on commit af8e137

Please sign in to comment.