Added category to learning sequence

This commit is contained in:
Lorenz Padberg 2022-04-14 15:03:36 +02:00
parent d217f60827
commit 53675aa69c
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,26 @@
# Generated by Django 3.2.12 on 2022-04-14 13:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('learnpath', '0003_circle_goals'),
]
operations = [
migrations.AlterModelOptions(
name='learningsequence',
options={'verbose_name': 'Learning Sequence'},
),
migrations.AlterModelOptions(
name='learningunit',
options={'verbose_name': 'Learning Unit'},
),
migrations.AddField(
model_name='learningsequence',
name='category',
field=models.CharField(choices=[('INCIRCLE', 'In Circle'), ('START', 'Start'), ('END', 'End')], default='INCIRCLE', max_length=16),
),
]

View File

@ -2,8 +2,8 @@
from django.db import models
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.core.fields import RichTextField
from wagtail.core.models import Page
from django.utils.translation import gettext_lazy as _
# class HomePage(Page):
@ -64,7 +64,21 @@ class Circle(Page):
return f"{self.title}"
IN_CIRCLE = 'INCIRCLE'
START = 'START'
END = 'END'
LEARNING_SEQUENCE_CATEGORIES = [
(IN_CIRCLE, 'In Circle'),
(START, 'Start'),
(END, 'End')
]
class LearningSequence(Page):
# TODO: How to do a icon choice field?
category = models.CharField(max_length=16, choices=LEARNING_SEQUENCE_CATEGORIES, default=IN_CIRCLE)
parent_page_types = ['learnpath.Circle']
subpage_types = ['learnpath.LearningUnit']