Skip to content

Commit

Permalink
Change chapter time to from DecimalBlock to IntegerBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Oct 21, 2024
1 parent 90b6c63 commit 662f762
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions etna/media/migrations/0002_etnamedia_chapters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.8 on 2024-10-11 14:46
# Generated by Django 5.0.8 on 2024-10-21 10:27

import django.core.validators
import wagtail.fields
Expand All @@ -20,7 +20,7 @@ class Migration(migrations.Migration):
blank=True,
block_lookup={
0: (
"wagtail.blocks.DecimalBlock",
"wagtail.blocks.IntegerBlock",
(),
{
"blank": True,
Expand Down
7 changes: 1 addition & 6 deletions etna/media/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


class MediaChapterSectionBlock(blocks.StructBlock):
time = blocks.DecimalBlock(
time = blocks.IntegerBlock(
blank=True,
default=0,
validators=[MinValueValidator(0)],
Expand All @@ -24,11 +24,6 @@ class MediaChapterSectionBlock(blocks.StructBlock):
heading = blocks.CharBlock(max_length=20)
transcript = APIRichTextBlock(required=False, features=["bold", "italic"])

def get_api_representation(self, value, context=None):
representation = super().get_api_representation(value, context)
representation["time"] = int(representation["time"])
return representation

class Meta:
label = "Chapter"

Expand Down

0 comments on commit 662f762

Please sign in to comment.