+ class="bg-white m-12 p-8 flex flex-col lg:flex-row divide-y lg:divide-y-0 lg:divide-x divide-gray-500 justify-start"
+ >
Willkommmen zurück, {{ userStore.first_name }}
-
-
-
+
Nächster Schirtt
-
{{ learningPathStore.learningPath.nextLearningContent.parentCircle.title }}: {{ learningPathStore.learningPath.nextLearningContent.parentLearningSequence.title }}
+
+ {{ learningPathStore.learningPath.nextLearningContent.parentCircle.title }}:
+ {{ learningPathStore.learningPath.nextLearningContent.parentLearningSequence.title }}
+
Los geht's
@@ -86,5 +84,4 @@ onMounted(async () => {
-
+
diff --git a/server/vbv_lernwelt/learnpath/models.py b/server/vbv_lernwelt/learnpath/models.py
index 78688654..71cc5528 100644
--- a/server/vbv_lernwelt/learnpath/models.py
+++ b/server/vbv_lernwelt/learnpath/models.py
@@ -22,7 +22,7 @@ class LearningPath(Page):
verbose_name = "Learning Path"
def full_clean(self, *args, **kwargs):
- self.slug = find_available_slug(Page, slugify(self.title, allow_unicode=True))
+ self.slug = find_available_slug(slugify(self.title, allow_unicode=True))
super(LearningPath, self).full_clean(*args, **kwargs)
def __str__(self):
@@ -54,8 +54,7 @@ class Topic(Page):
# subpage_types = ['learnpath.Circle']
def full_clean(self, *args, **kwargs):
- self.slug = find_available_slug(Topic, slugify(self.title, allow_unicode=True))
- print(self.slug)
+ self.slug = find_available_slug(slugify(f'topic-{self.title}', allow_unicode=True))
super(Topic, self).full_clean(*args, **kwargs)
@classmethod
@@ -115,8 +114,7 @@ class Circle(Page):
)
def full_clean(self, *args, **kwargs):
- # TODO: why own slug function?
- self.slug = find_available_slug(Page, slugify(self.title, allow_unicode=True))
+ self.slug = find_available_slug(slugify(self.title, allow_unicode=True))
super(Circle, self).full_clean(*args, **kwargs)
class Meta:
@@ -157,6 +155,7 @@ class LearningSequence(Page):
'''
def full_clean(self, *args, **kwargs):
+ self.slug = find_available_slug(slugify(f'ls-{self.title}', allow_unicode=True))
super(LearningSequence, self).full_clean(*args, **kwargs)
@@ -170,6 +169,10 @@ class LearningUnit(Page):
def __str__(self):
return f"{self.title}"
+ def full_clean(self, *args, **kwargs):
+ self.slug = find_available_slug(slugify(f'lu-{self.title}', allow_unicode=True))
+ super(LearningUnit, self).full_clean(*args, **kwargs)
+
@classmethod
def get_serializer_class(cls):
return get_it_serializer_class(cls, field_names=['id', 'title', 'slug', 'type', 'translation_key', 'children'])
@@ -188,6 +191,10 @@ class LearningUnitQuestion(Page):
def __str__(self):
return f"{self.title}"
+ def full_clean(self, *args, **kwargs):
+ self.slug = find_available_slug(slugify(f'luq-{self.title}', allow_unicode=True))
+ super(LearningUnitQuestion, self).full_clean(*args, **kwargs)
+
@classmethod
def get_serializer_class(cls):
return get_it_serializer_class(cls, field_names=['id', 'title', 'slug', 'type', 'translation_key', ])
@@ -240,7 +247,8 @@ class LearningContent(Page):
verbose_name = "Learning Content"
def full_clean(self, *args, **kwargs):
- self.slug = find_available_slug(LearningContent, slugify(self.title, allow_unicode=True))
+ self.slug = find_available_slug(slugify(f'lc-{self.title}', allow_unicode=True))
+ print(self.slug)
super(LearningContent, self).full_clean(*args, **kwargs)
@classmethod
@@ -253,7 +261,7 @@ class LearningContent(Page):
return f"{self.title}"
-def find_available_slug(model, requested_slug, ignore_page_id=None):
+def find_available_slug(requested_slug, ignore_page_id=None):
"""
Finds an available slug within the specified parent.
@@ -270,8 +278,7 @@ def find_available_slug(model, requested_slug, ignore_page_id=None):
treated as in use by another page.
"""
- # TODO: In comparison ot wagtails own function, I look for the same model instead of the parent
- pages = model.objects.filter(slug__startswith=requested_slug)
+ pages = Page.objects.filter(slug__startswith=requested_slug)
if ignore_page_id:
pages = pages.exclude(id=ignore_page_id)