Add comment to mark code to be discussed
This commit is contained in:
parent
eeb0664a25
commit
82d6ceb737
|
|
@ -1,16 +1,16 @@
|
||||||
from django import forms
|
from core.constants import DEFAULT_RICH_TEXT_FEATURES
|
||||||
|
from core.wagtail_utils import StrictHierarchyPage, get_default_settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from wagtail.admin.forms import WagtailAdminPageForm
|
|
||||||
from wagtail.admin.panels import FieldPanel, TabbedInterface, ObjectList, TitleFieldPanel
|
|
||||||
from wagtail.fields import RichTextField
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from core.constants import DEFAULT_RICH_TEXT_FEATURES
|
|
||||||
from core.wagtail_utils import StrictHierarchyPage, get_default_settings
|
|
||||||
from users.models import SchoolClass
|
from users.models import SchoolClass
|
||||||
from django.utils.text import slugify
|
from wagtail.admin.panels import (
|
||||||
|
FieldPanel,
|
||||||
|
ObjectList,
|
||||||
|
TabbedInterface,
|
||||||
|
TitleFieldPanel,
|
||||||
|
)
|
||||||
|
from wagtail.fields import RichTextField
|
||||||
|
|
||||||
EXACT = "exact"
|
EXACT = "exact"
|
||||||
|
|
||||||
|
|
@ -52,6 +52,7 @@ class ModuleCategory(models.Model):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.name}"
|
return f"{self.name}"
|
||||||
|
|
||||||
|
|
||||||
# Commented out since that check is not necessary if a slug is chosen that is already in use
|
# Commented out since that check is not necessary if a slug is chosen that is already in use
|
||||||
# a new one will be generated
|
# a new one will be generated
|
||||||
# TODO: remove after pullrequest is merged
|
# TODO: remove after pullrequest is merged
|
||||||
|
|
@ -111,7 +112,7 @@ class Module(StrictHierarchyPage):
|
||||||
FieldPanel("intro"),
|
FieldPanel("intro"),
|
||||||
]
|
]
|
||||||
# TODO remove after pullrequest is merged
|
# TODO remove after pullrequest is merged
|
||||||
#base_form_class = ModulePageForm
|
# base_form_class = ModulePageForm
|
||||||
|
|
||||||
edit_handler = TabbedInterface(
|
edit_handler = TabbedInterface(
|
||||||
[ObjectList(content_panels, heading="Content"), get_default_settings()]
|
[ObjectList(content_panels, heading="Content"), get_default_settings()]
|
||||||
|
|
@ -221,11 +222,11 @@ class Module(StrictHierarchyPage):
|
||||||
super().full_clean(*args, **kwargs)
|
super().full_clean(*args, **kwargs)
|
||||||
|
|
||||||
# Always create a slug if it is not available
|
# Always create a slug if it is not available
|
||||||
|
# todo: do we really want to do this? this will silently change a slug if the users sets one that already exists, which probably isn't what they expect
|
||||||
if not self._slug_is_available(self.slug, self.get_parent(), self):
|
if not self._slug_is_available(self.slug, self.get_parent(), self):
|
||||||
self.slug = self._get_autogenerated_slug(self.slug)
|
self.slug = self._get_autogenerated_slug(self.slug)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RecentModule(models.Model):
|
class RecentModule(models.Model):
|
||||||
module = models.ForeignKey(
|
module = models.ForeignKey(
|
||||||
Module, on_delete=models.CASCADE, related_name="recent_modules"
|
Module, on_delete=models.CASCADE, related_name="recent_modules"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue