From d963f58264cae1a7ef136dbbce7e59920334334a Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 5 Nov 2024 21:26:12 +0100 Subject: [PATCH] refactor: register unit models in app setup --- openedx_learning/apps/authoring/containers/apps.py | 2 +- openedx_learning/apps/authoring/units/apps.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/openedx_learning/apps/authoring/containers/apps.py b/openedx_learning/apps/authoring/containers/apps.py index 98320555..e8b2e36a 100644 --- a/openedx_learning/apps/authoring/containers/apps.py +++ b/openedx_learning/apps/authoring/containers/apps.py @@ -18,7 +18,7 @@ class ContainersConfig(AppConfig): def ready(self): """ - Register Component and ComponentVersion. + Register ContainerEntity and ContainerEntityVersion. """ from ..publishing.api import register_content_models # pylint: disable=import-outside-toplevel from .models import ContainerEntity, ContainerEntityVersion # pylint: disable=import-outside-toplevel diff --git a/openedx_learning/apps/authoring/units/apps.py b/openedx_learning/apps/authoring/units/apps.py index a63f0d3d..f0beecf3 100644 --- a/openedx_learning/apps/authoring/units/apps.py +++ b/openedx_learning/apps/authoring/units/apps.py @@ -14,3 +14,12 @@ class UnitsConfig(AppConfig): verbose_name = "Learning Core > Authoring > Units" default_auto_field = "django.db.models.BigAutoField" label = "oel_units" + + def ready(self): + """ + Register Unit and UnitVersion. + """ + from ..publishing.api import register_content_models # pylint: disable=import-outside-toplevel + from .models import Unit, UnitVersion # pylint: disable=import-outside-toplevel + + register_content_models(Unit, UnitVersion)