diff --git a/openedx_learning/apps/authoring/components/apps.py b/openedx_learning/apps/authoring/components/apps.py index 07c84c046..591e60f6c 100644 --- a/openedx_learning/apps/authoring/components/apps.py +++ b/openedx_learning/apps/authoring/components/apps.py @@ -18,7 +18,7 @@ def ready(self) -> None: """ Register Component and ComponentVersion. """ - from ..publishing.api import register_content_models # pylint: disable=import-outside-toplevel + from ..publishing.api import register_publishable_models # pylint: disable=import-outside-toplevel from .models import Component, ComponentVersion # pylint: disable=import-outside-toplevel - register_content_models(Component, ComponentVersion) + register_publishable_models(Component, ComponentVersion) diff --git a/openedx_learning/apps/authoring/publishing/api.py b/openedx_learning/apps/authoring/publishing/api.py index 6ba022ac1..388f52cba 100644 --- a/openedx_learning/apps/authoring/publishing/api.py +++ b/openedx_learning/apps/authoring/publishing/api.py @@ -69,7 +69,7 @@ "set_draft_version", "soft_delete_draft", "reset_drafts_to_published", - "register_content_models", + "register_publishable_models", "filter_publishable_entities", # 🛑 UNSTABLE: All APIs related to containers are unstable until we've figured # out our approach to dynamic content (randomized, A/B tests, etc.) @@ -789,7 +789,7 @@ def reset_drafts_to_published( set_draft_version(draft, published_version_id) -def register_content_models( +def register_publishable_models( content_model_cls: type[PublishableEntityMixin], content_version_model_cls: type[PublishableEntityVersionMixin], ) -> PublishableContentModelRegistry: @@ -805,10 +805,10 @@ def register_content_models( method. For example, in the components app, this looks like: def ready(self): - from ..publishing.api import register_content_models + from ..publishing.api import register_publishable_models from .models import Component, ComponentVersion - register_content_models(Component, ComponentVersion) + register_publishable_models(Component, ComponentVersion) There may be a more clever way to introspect this information from the model metadata, but this is simple and explicit. diff --git a/openedx_learning/apps/authoring/publishing/apps.py b/openedx_learning/apps/authoring/publishing/apps.py index f5a8b1f9a..d3aefd8a6 100644 --- a/openedx_learning/apps/authoring/publishing/apps.py +++ b/openedx_learning/apps/authoring/publishing/apps.py @@ -19,7 +19,7 @@ def ready(self): """ Register Container and ContainerVersion. """ - from .api import register_content_models # pylint: disable=import-outside-toplevel + from .api import register_publishable_models # pylint: disable=import-outside-toplevel from .models import Container, ContainerVersion # pylint: disable=import-outside-toplevel - register_content_models(Container, ContainerVersion) + register_publishable_models(Container, ContainerVersion) diff --git a/openedx_learning/apps/authoring/publishing/models/publishable_entity.py b/openedx_learning/apps/authoring/publishing/models/publishable_entity.py index 87619ee69..0a95e0a9e 100644 --- a/openedx_learning/apps/authoring/publishing/models/publishable_entity.py +++ b/openedx_learning/apps/authoring/publishing/models/publishable_entity.py @@ -272,7 +272,7 @@ class PublishableEntityMixin(models.Model): Please see docstring for PublishableEntity for more details. If you use this class, you *MUST* also use PublishableEntityVersionMixin and - the publishing app's api.register_content_models (see its docstring for + the publishing app's api.register_publishable_models (see its docstring for details). """ # select these related entities by default for all queries @@ -551,7 +551,7 @@ class PublishableEntityVersionMixin(models.Model): Please see docstring for PublishableEntityVersion for more details. If you use this class, you *MUST* also use PublishableEntityMixin and the - publishing app's api.register_content_models (see its docstring for + publishing app's api.register_publishable_models (see its docstring for details). """ @@ -609,7 +609,7 @@ def register( Register what content model maps to what content version model. If you want to call this from another app, please use the - ``register_content_models`` function in this app's ``api`` module + ``register_publishable_models`` function in this app's ``api`` module instead. """ if not issubclass(content_model_cls, PublishableEntityMixin): diff --git a/openedx_learning/apps/authoring/sections/apps.py b/openedx_learning/apps/authoring/sections/apps.py index 42c8d6ec9..f506229e2 100644 --- a/openedx_learning/apps/authoring/sections/apps.py +++ b/openedx_learning/apps/authoring/sections/apps.py @@ -19,7 +19,7 @@ def ready(self): """ Register Section and SectionVersion. """ - from ..publishing.api import register_content_models # pylint: disable=import-outside-toplevel + from ..publishing.api import register_publishable_models # pylint: disable=import-outside-toplevel from .models import Section, SectionVersion # pylint: disable=import-outside-toplevel - register_content_models(Section, SectionVersion) + register_publishable_models(Section, SectionVersion) diff --git a/openedx_learning/apps/authoring/subsections/apps.py b/openedx_learning/apps/authoring/subsections/apps.py index 281246da0..950e14143 100644 --- a/openedx_learning/apps/authoring/subsections/apps.py +++ b/openedx_learning/apps/authoring/subsections/apps.py @@ -19,7 +19,7 @@ def ready(self): """ Register Subsection and SubsectionVersion. """ - from ..publishing.api import register_content_models # pylint: disable=import-outside-toplevel + from ..publishing.api import register_publishable_models # pylint: disable=import-outside-toplevel from .models import Subsection, SubsectionVersion # pylint: disable=import-outside-toplevel - register_content_models(Subsection, SubsectionVersion) + register_publishable_models(Subsection, SubsectionVersion) diff --git a/openedx_learning/apps/authoring/units/apps.py b/openedx_learning/apps/authoring/units/apps.py index f0beecf3d..17affcf25 100644 --- a/openedx_learning/apps/authoring/units/apps.py +++ b/openedx_learning/apps/authoring/units/apps.py @@ -19,7 +19,7 @@ def ready(self): """ Register Unit and UnitVersion. """ - from ..publishing.api import register_content_models # pylint: disable=import-outside-toplevel + from ..publishing.api import register_publishable_models # pylint: disable=import-outside-toplevel from .models import Unit, UnitVersion # pylint: disable=import-outside-toplevel - register_content_models(Unit, UnitVersion) + register_publishable_models(Unit, UnitVersion)