openedx-learning 0.18.2__tar.gz → 0.19.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openedx_learning-0.18.2/openedx_learning.egg-info → openedx_learning-0.19.0}/PKG-INFO +2 -2
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/__init__.py +1 -1
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/api/authoring.py +1 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/api/authoring_models.py +1 -1
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/api.py +3 -3
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/apps.py +1 -1
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/models.py +9 -14
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/models.py +1 -1
- openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/api.py +971 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/publishing/apps.py +9 -0
- openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/migrations/0003_containers.py +54 -0
- openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/models/__init__.py +27 -0
- openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/models/container.py +70 -0
- openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/models/draft_published.py +95 -0
- openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/models/entity_list.py +69 -0
- openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/models/learning_package.py +75 -0
- openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/models/publish_log.py +106 -0
- openedx_learning-0.18.2/openedx_learning/apps/authoring/publishing/model_mixins.py → openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/models/publishable_entity.py +284 -41
- openedx_learning-0.19.0/openedx_learning/apps/authoring/units/api.py +290 -0
- openedx_learning-0.19.0/openedx_learning/apps/authoring/units/apps.py +25 -0
- openedx_learning-0.19.0/openedx_learning/apps/authoring/units/migrations/0001_initial.py +36 -0
- openedx_learning-0.19.0/openedx_learning/apps/authoring/units/models.py +50 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/contrib/media_server/apps.py +1 -1
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/managers.py +7 -1
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/validators.py +1 -1
- {openedx_learning-0.18.2 → openedx_learning-0.19.0/openedx_learning.egg-info}/PKG-INFO +2 -2
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning.egg-info/SOURCES.txt +14 -2
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/api.py +11 -4
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/models/base.py +1 -1
- openedx_learning-0.19.0/openedx_tagging/core/tagging/rest_api/v1/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/v1/permissions.py +1 -1
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rules.py +1 -2
- openedx_learning-0.19.0/openedx_tagging/py.typed +0 -0
- openedx_learning-0.18.2/openedx_learning/apps/authoring/publishing/api.py +0 -515
- openedx_learning-0.18.2/openedx_learning/apps/authoring/publishing/models.py +0 -517
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/CHANGELOG.rst +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/LICENSE.txt +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/MANIFEST.in +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/README.rst +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/api/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/admin.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/api.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/apps.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/migrations/0001_initial.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/migrations/0002_remove_collection_name_collection_created_by_and_more.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/migrations/0003_collection_entities.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/migrations/0004_collection_key.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/migrations/0005_alter_collection_options_alter_collection_enabled.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/migrations/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/models.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/admin.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/management/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/management/commands/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/management/commands/add_assets_to_component.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/migrations/0001_initial.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/migrations/0002_alter_componentversioncontent_key.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/migrations/0003_remove_componentversioncontent_learner_downloadable.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/migrations/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/admin.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/api.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/apps.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/migrations/0001_initial.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/migrations/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/publishing/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/publishing/admin.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/publishing/migrations/0001_initial.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/publishing/migrations/0002_alter_learningpackage_key_and_more.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/publishing/migrations/__init__.py +0 -0
- {openedx_learning-0.18.2/openedx_learning/contrib → openedx_learning-0.19.0/openedx_learning/apps/authoring/units}/__init__.py +0 -0
- {openedx_learning-0.18.2/openedx_learning/lib → openedx_learning-0.19.0/openedx_learning/apps/authoring/units/migrations}/__init__.py +0 -0
- {openedx_learning-0.18.2/openedx_tagging/core → openedx_learning-0.19.0/openedx_learning/contrib}/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/contrib/media_server/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/contrib/media_server/urls.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/contrib/media_server/views.py +0 -0
- {openedx_learning-0.18.2/openedx_tagging/core/tagging → openedx_learning-0.19.0/openedx_learning/lib}/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/admin_utils.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/cache.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/collations.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/fields.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/test_utils.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/py.typed +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning.egg-info/dependency_links.txt +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning.egg-info/not-zip-safe +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning.egg-info/requires.txt +1 -1
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning.egg-info/top_level.txt +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/__init__.py +0 -0
- {openedx_learning-0.18.2/openedx_tagging/core/tagging/migrations → openedx_learning-0.19.0/openedx_tagging/core}/__init__.py +0 -0
- {openedx_learning-0.18.2/openedx_tagging/core/tagging/rest_api → openedx_learning-0.19.0/openedx_tagging/core/tagging}/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/admin.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/apps.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/data.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/actions.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/api.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/exceptions.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/import_plan.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/parsers.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/tasks.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/template.csv +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/template.json +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0001_initial.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0001_squashed.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0002_auto_20230718_2026.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0003_auto_20230721_1238.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0004_auto_20230723_2001.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0005_language_taxonomy.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0006_alter_objecttag_unique_together.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0006_auto_20230802_1631.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0007_tag_import_task_log_null_fix.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0008_taxonomy_description_not_null.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0009_alter_objecttag_object_id.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0010_cleanups.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0011_remove_required.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0012_language_taxonomy.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0013_tag_parent_blank.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0014_minor_fixes.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0015_taxonomy_export_id.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0016_object_tag_export_id.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0017_alter_tagimporttask_status.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0018_objecttag_is_copied.py +0 -0
- {openedx_learning-0.18.2/openedx_tagging/core/tagging/rest_api/v1 → openedx_learning-0.19.0/openedx_tagging/core/tagging/migrations}/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/models/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/models/import_export.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/models/system_defined.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/models/utils.py +0 -0
- /openedx_learning-0.18.2/openedx_tagging/py.typed → /openedx_learning-0.19.0/openedx_tagging/core/tagging/rest_api/__init__.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/paginators.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/urls.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/utils.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/v1/serializers.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/v1/urls.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/v1/views.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/v1/views_import.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/urls.py +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/requirements/base.in +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/setup.cfg +0 -0
- {openedx_learning-0.18.2 → openedx_learning-0.19.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: openedx-learning
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.19.0
|
|
4
4
|
Summary: Open edX Learning Core and Tagging.
|
|
5
5
|
Home-page: https://github.com/openedx/openedx-learning
|
|
6
6
|
Author: David Ormsbee
|
|
@@ -19,9 +19,9 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
19
19
|
Requires-Python: >=3.11
|
|
20
20
|
License-File: LICENSE.txt
|
|
21
21
|
Requires-Dist: attrs
|
|
22
|
-
Requires-Dist: edx-drf-extensions
|
|
23
22
|
Requires-Dist: Django<5.0
|
|
24
23
|
Requires-Dist: rules<4.0
|
|
24
|
+
Requires-Dist: edx-drf-extensions
|
|
25
25
|
Requires-Dist: celery
|
|
26
26
|
Requires-Dist: djangorestframework<4.0
|
|
27
27
|
Dynamic: author
|
|
@@ -13,6 +13,7 @@ from ..apps.authoring.collections.api import *
|
|
|
13
13
|
from ..apps.authoring.components.api import *
|
|
14
14
|
from ..apps.authoring.contents.api import *
|
|
15
15
|
from ..apps.authoring.publishing.api import *
|
|
16
|
+
from ..apps.authoring.units.api import *
|
|
16
17
|
|
|
17
18
|
# This was renamed after the authoring API refactoring pushed this and other
|
|
18
19
|
# app APIs into the openedx_learning.api.authoring module. Here I'm aliasing to
|
{openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/api/authoring_models.py
RENAMED
|
@@ -10,5 +10,5 @@ consistent.
|
|
|
10
10
|
from ..apps.authoring.collections.models import *
|
|
11
11
|
from ..apps.authoring.components.models import *
|
|
12
12
|
from ..apps.authoring.contents.models import *
|
|
13
|
-
from ..apps.authoring.publishing.model_mixins import *
|
|
14
13
|
from ..apps.authoring.publishing.models import *
|
|
14
|
+
from ..apps.authoring.units.models import *
|
|
@@ -231,7 +231,7 @@ def create_next_component_version(
|
|
|
231
231
|
return component_version
|
|
232
232
|
|
|
233
233
|
|
|
234
|
-
def create_component_and_version(
|
|
234
|
+
def create_component_and_version( # pylint: disable=too-many-positional-arguments
|
|
235
235
|
learning_package_id: int,
|
|
236
236
|
/,
|
|
237
237
|
component_type: ComponentType,
|
|
@@ -326,7 +326,7 @@ def component_exists_by_key(
|
|
|
326
326
|
return False
|
|
327
327
|
|
|
328
328
|
|
|
329
|
-
def get_components(
|
|
329
|
+
def get_components( # pylint: disable=too-many-positional-arguments
|
|
330
330
|
learning_package_id: int,
|
|
331
331
|
/,
|
|
332
332
|
draft: bool | None = None,
|
|
@@ -468,7 +468,7 @@ def _get_component_version_info_headers(component_version: ComponentVersion) ->
|
|
|
468
468
|
"X-Open-edX-Component-Uuid": component.uuid,
|
|
469
469
|
# Component Version
|
|
470
470
|
"X-Open-edX-Component-Version-Uuid": component_version.uuid,
|
|
471
|
-
"X-Open-edX-Component-Version-Num": component_version.version_num,
|
|
471
|
+
"X-Open-edX-Component-Version-Num": str(component_version.version_num),
|
|
472
472
|
# Learning Package
|
|
473
473
|
"X-Open-edX-Learning-Package-Key": learning_package.key,
|
|
474
474
|
"X-Open-edX-Learning-Package-Uuid": learning_package.uuid,
|
|
@@ -17,13 +17,14 @@ convention, but it's possible we might want to have special identifiers later.
|
|
|
17
17
|
"""
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
|
+
from typing import ClassVar
|
|
21
|
+
|
|
20
22
|
from django.db import models
|
|
21
23
|
|
|
22
24
|
from ....lib.fields import case_sensitive_char_field, immutable_uuid_field, key_field
|
|
23
25
|
from ....lib.managers import WithRelationsManager
|
|
24
26
|
from ..contents.models import Content
|
|
25
|
-
from ..publishing.
|
|
26
|
-
from ..publishing.models import LearningPackage
|
|
27
|
+
from ..publishing.models import LearningPackage, PublishableEntityMixin, PublishableEntityVersionMixin
|
|
27
28
|
|
|
28
29
|
__all__ = [
|
|
29
30
|
"ComponentType",
|
|
@@ -72,11 +73,11 @@ class ComponentType(models.Model):
|
|
|
72
73
|
),
|
|
73
74
|
]
|
|
74
75
|
|
|
75
|
-
def __str__(self):
|
|
76
|
+
def __str__(self) -> str:
|
|
76
77
|
return f"{self.namespace}:{self.name}"
|
|
77
78
|
|
|
78
79
|
|
|
79
|
-
class Component(PublishableEntityMixin):
|
|
80
|
+
class Component(PublishableEntityMixin):
|
|
80
81
|
"""
|
|
81
82
|
This represents any Component that has ever existed in a LearningPackage.
|
|
82
83
|
|
|
@@ -120,14 +121,12 @@ class Component(PublishableEntityMixin): # type: ignore[django-manager-missing]
|
|
|
120
121
|
Make a foreign key to the Component model when you need a stable reference
|
|
121
122
|
that will exist for as long as the LearningPackage itself exists.
|
|
122
123
|
"""
|
|
123
|
-
#
|
|
124
|
-
|
|
125
|
-
# interface as the base manager class.
|
|
126
|
-
objects: models.Manager[Component] = WithRelationsManager(
|
|
124
|
+
# Set up our custom manager. It has the same API as the default one, but selects related objects by default.
|
|
125
|
+
objects: ClassVar[WithRelationsManager[Component]] = WithRelationsManager( # type: ignore[assignment]
|
|
127
126
|
'component_type'
|
|
128
127
|
)
|
|
129
128
|
|
|
130
|
-
with_publishing_relations
|
|
129
|
+
with_publishing_relations = WithRelationsManager(
|
|
131
130
|
'component_type',
|
|
132
131
|
'publishable_entity',
|
|
133
132
|
'publishable_entity__draft__version',
|
|
@@ -190,7 +189,7 @@ class Component(PublishableEntityMixin): # type: ignore[django-manager-missing]
|
|
|
190
189
|
verbose_name = "Component"
|
|
191
190
|
verbose_name_plural = "Components"
|
|
192
191
|
|
|
193
|
-
def __str__(self):
|
|
192
|
+
def __str__(self) -> str:
|
|
194
193
|
return f"{self.component_type.namespace}:{self.component_type.name}:{self.local_key}"
|
|
195
194
|
|
|
196
195
|
|
|
@@ -201,10 +200,6 @@ class ComponentVersion(PublishableEntityVersionMixin):
|
|
|
201
200
|
This holds the content using a M:M relationship with Content via
|
|
202
201
|
ComponentVersionContent.
|
|
203
202
|
"""
|
|
204
|
-
# Tell mypy what type our objects manager has.
|
|
205
|
-
# It's actually PublishableEntityVersionMixinManager, but that has the exact
|
|
206
|
-
# same interface as the base manager class.
|
|
207
|
-
objects: models.Manager[ComponentVersion]
|
|
208
203
|
|
|
209
204
|
# This is technically redundant, since we can get this through
|
|
210
205
|
# publishable_entity_version.publishable.component, but this is more
|