openedx-learning 0.18.3__tar.gz → 0.19.1__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.3/openedx_learning.egg-info → openedx_learning-0.19.1}/PKG-INFO +3 -3
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/__init__.py +1 -1
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/api/authoring.py +1 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/api/authoring_models.py +1 -1
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/components/api.py +18 -5
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/components/apps.py +1 -1
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/components/models.py +9 -14
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/contents/models.py +1 -1
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/publishing/admin.py +3 -0
- openedx_learning-0.19.1/openedx_learning/apps/authoring/publishing/api.py +1020 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/publishing/apps.py +9 -0
- openedx_learning-0.19.1/openedx_learning/apps/authoring/publishing/migrations/0003_containers.py +54 -0
- openedx_learning-0.19.1/openedx_learning/apps/authoring/publishing/migrations/0004_publishableentity_can_stand_alone.py +21 -0
- openedx_learning-0.19.1/openedx_learning/apps/authoring/publishing/models/__init__.py +27 -0
- openedx_learning-0.19.1/openedx_learning/apps/authoring/publishing/models/container.py +70 -0
- openedx_learning-0.19.1/openedx_learning/apps/authoring/publishing/models/draft_published.py +95 -0
- openedx_learning-0.19.1/openedx_learning/apps/authoring/publishing/models/entity_list.py +69 -0
- openedx_learning-0.19.1/openedx_learning/apps/authoring/publishing/models/learning_package.py +75 -0
- openedx_learning-0.19.1/openedx_learning/apps/authoring/publishing/models/publish_log.py +106 -0
- openedx_learning-0.18.3/openedx_learning/apps/authoring/publishing/model_mixins.py → openedx_learning-0.19.1/openedx_learning/apps/authoring/publishing/models/publishable_entity.py +289 -41
- openedx_learning-0.19.1/openedx_learning/apps/authoring/units/api.py +305 -0
- openedx_learning-0.19.1/openedx_learning/apps/authoring/units/apps.py +25 -0
- openedx_learning-0.19.1/openedx_learning/apps/authoring/units/migrations/0001_initial.py +36 -0
- openedx_learning-0.19.1/openedx_learning/apps/authoring/units/models.py +50 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/contrib/media_server/apps.py +1 -1
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/lib/managers.py +7 -1
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/lib/validators.py +1 -1
- {openedx_learning-0.18.3 → openedx_learning-0.19.1/openedx_learning.egg-info}/PKG-INFO +3 -3
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning.egg-info/SOURCES.txt +15 -2
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/api.py +4 -4
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/models/base.py +1 -1
- openedx_learning-0.19.1/openedx_tagging/core/tagging/rest_api/v1/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/rest_api/v1/permissions.py +1 -1
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/rules.py +1 -2
- openedx_learning-0.19.1/openedx_tagging/py.typed +0 -0
- openedx_learning-0.18.3/openedx_learning/apps/authoring/publishing/api.py +0 -515
- openedx_learning-0.18.3/openedx_learning/apps/authoring/publishing/models.py +0 -517
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/CHANGELOG.rst +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/LICENSE.txt +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/MANIFEST.in +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/README.rst +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/api/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/collections/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/collections/admin.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/collections/api.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/collections/apps.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/collections/migrations/0001_initial.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/collections/migrations/0002_remove_collection_name_collection_created_by_and_more.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/collections/migrations/0003_collection_entities.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/collections/migrations/0004_collection_key.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/collections/migrations/0005_alter_collection_options_alter_collection_enabled.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/collections/migrations/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/collections/models.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/components/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/components/admin.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/components/management/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/components/management/commands/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/components/management/commands/add_assets_to_component.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/components/migrations/0001_initial.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/components/migrations/0002_alter_componentversioncontent_key.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/components/migrations/0003_remove_componentversioncontent_learner_downloadable.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/components/migrations/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/contents/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/contents/admin.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/contents/api.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/contents/apps.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/contents/migrations/0001_initial.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/contents/migrations/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/publishing/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/publishing/migrations/0001_initial.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/publishing/migrations/0002_alter_learningpackage_key_and_more.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/apps/authoring/publishing/migrations/__init__.py +0 -0
- {openedx_learning-0.18.3/openedx_learning/contrib → openedx_learning-0.19.1/openedx_learning/apps/authoring/units}/__init__.py +0 -0
- {openedx_learning-0.18.3/openedx_learning/lib → openedx_learning-0.19.1/openedx_learning/apps/authoring/units/migrations}/__init__.py +0 -0
- {openedx_learning-0.18.3/openedx_tagging/core → openedx_learning-0.19.1/openedx_learning/contrib}/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/contrib/media_server/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/contrib/media_server/urls.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/contrib/media_server/views.py +0 -0
- {openedx_learning-0.18.3/openedx_tagging/core/tagging → openedx_learning-0.19.1/openedx_learning/lib}/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/lib/admin_utils.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/lib/cache.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/lib/collations.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/lib/fields.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/lib/test_utils.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning/py.typed +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning.egg-info/dependency_links.txt +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning.egg-info/not-zip-safe +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning.egg-info/requires.txt +2 -2
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_learning.egg-info/top_level.txt +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/__init__.py +0 -0
- {openedx_learning-0.18.3/openedx_tagging/core/tagging/migrations → openedx_learning-0.19.1/openedx_tagging/core}/__init__.py +0 -0
- {openedx_learning-0.18.3/openedx_tagging/core/tagging/rest_api → openedx_learning-0.19.1/openedx_tagging/core/tagging}/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/admin.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/apps.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/data.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/import_export/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/import_export/actions.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/import_export/api.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/import_export/exceptions.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/import_export/import_plan.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/import_export/parsers.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/import_export/tasks.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/import_export/template.csv +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/import_export/template.json +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0001_initial.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0001_squashed.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0002_auto_20230718_2026.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0003_auto_20230721_1238.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0004_auto_20230723_2001.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0005_language_taxonomy.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0006_alter_objecttag_unique_together.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0006_auto_20230802_1631.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0007_tag_import_task_log_null_fix.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0008_taxonomy_description_not_null.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0009_alter_objecttag_object_id.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0010_cleanups.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0011_remove_required.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0012_language_taxonomy.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0013_tag_parent_blank.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0014_minor_fixes.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0015_taxonomy_export_id.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0016_object_tag_export_id.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0017_alter_tagimporttask_status.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/migrations/0018_objecttag_is_copied.py +0 -0
- {openedx_learning-0.18.3/openedx_tagging/core/tagging/rest_api/v1 → openedx_learning-0.19.1/openedx_tagging/core/tagging/migrations}/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/models/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/models/import_export.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/models/system_defined.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/models/utils.py +0 -0
- /openedx_learning-0.18.3/openedx_tagging/py.typed → /openedx_learning-0.19.1/openedx_tagging/core/tagging/rest_api/__init__.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/rest_api/paginators.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/rest_api/urls.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/rest_api/utils.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/rest_api/v1/serializers.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/rest_api/v1/urls.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/rest_api/v1/views.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/rest_api/v1/views_import.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/openedx_tagging/core/tagging/urls.py +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/requirements/base.in +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/setup.cfg +0 -0
- {openedx_learning-0.18.3 → openedx_learning-0.19.1}/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.1
|
|
4
4
|
Summary: Open edX Learning Core and Tagging.
|
|
5
5
|
Home-page: https://github.com/openedx/openedx-learning
|
|
6
6
|
Author: David Ormsbee
|
|
@@ -18,11 +18,11 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
19
|
Requires-Python: >=3.11
|
|
20
20
|
License-File: LICENSE.txt
|
|
21
|
-
Requires-Dist: rules<4.0
|
|
22
|
-
Requires-Dist: attrs
|
|
23
21
|
Requires-Dist: edx-drf-extensions
|
|
24
22
|
Requires-Dist: Django<5.0
|
|
23
|
+
Requires-Dist: rules<4.0
|
|
25
24
|
Requires-Dist: celery
|
|
25
|
+
Requires-Dist: attrs
|
|
26
26
|
Requires-Dist: djangorestframework<4.0
|
|
27
27
|
Dynamic: author
|
|
28
28
|
Dynamic: author-email
|
|
@@ -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.3 → openedx_learning-0.19.1}/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 *
|
|
@@ -83,6 +83,8 @@ def create_component(
|
|
|
83
83
|
local_key: str,
|
|
84
84
|
created: datetime,
|
|
85
85
|
created_by: int | None,
|
|
86
|
+
*,
|
|
87
|
+
can_stand_alone: bool = True,
|
|
86
88
|
) -> Component:
|
|
87
89
|
"""
|
|
88
90
|
Create a new Component (an entity like a Problem or Video)
|
|
@@ -90,7 +92,11 @@ def create_component(
|
|
|
90
92
|
key = f"{component_type.namespace}:{component_type.name}:{local_key}"
|
|
91
93
|
with atomic():
|
|
92
94
|
publishable_entity = publishing_api.create_publishable_entity(
|
|
93
|
-
learning_package_id,
|
|
95
|
+
learning_package_id,
|
|
96
|
+
key,
|
|
97
|
+
created,
|
|
98
|
+
created_by,
|
|
99
|
+
can_stand_alone=can_stand_alone
|
|
94
100
|
)
|
|
95
101
|
component = Component.objects.create(
|
|
96
102
|
publishable_entity=publishable_entity,
|
|
@@ -231,7 +237,7 @@ def create_next_component_version(
|
|
|
231
237
|
return component_version
|
|
232
238
|
|
|
233
239
|
|
|
234
|
-
def create_component_and_version(
|
|
240
|
+
def create_component_and_version( # pylint: disable=too-many-positional-arguments
|
|
235
241
|
learning_package_id: int,
|
|
236
242
|
/,
|
|
237
243
|
component_type: ComponentType,
|
|
@@ -239,13 +245,20 @@ def create_component_and_version(
|
|
|
239
245
|
title: str,
|
|
240
246
|
created: datetime,
|
|
241
247
|
created_by: int | None = None,
|
|
248
|
+
*,
|
|
249
|
+
can_stand_alone: bool = True,
|
|
242
250
|
) -> tuple[Component, ComponentVersion]:
|
|
243
251
|
"""
|
|
244
252
|
Create a Component and associated ComponentVersion atomically
|
|
245
253
|
"""
|
|
246
254
|
with atomic():
|
|
247
255
|
component = create_component(
|
|
248
|
-
learning_package_id,
|
|
256
|
+
learning_package_id,
|
|
257
|
+
component_type,
|
|
258
|
+
local_key,
|
|
259
|
+
created,
|
|
260
|
+
created_by,
|
|
261
|
+
can_stand_alone=can_stand_alone,
|
|
249
262
|
)
|
|
250
263
|
component_version = create_component_version(
|
|
251
264
|
component.pk,
|
|
@@ -326,7 +339,7 @@ def component_exists_by_key(
|
|
|
326
339
|
return False
|
|
327
340
|
|
|
328
341
|
|
|
329
|
-
def get_components(
|
|
342
|
+
def get_components( # pylint: disable=too-many-positional-arguments
|
|
330
343
|
learning_package_id: int,
|
|
331
344
|
/,
|
|
332
345
|
draft: bool | None = None,
|
|
@@ -468,7 +481,7 @@ def _get_component_version_info_headers(component_version: ComponentVersion) ->
|
|
|
468
481
|
"X-Open-edX-Component-Uuid": component.uuid,
|
|
469
482
|
# Component Version
|
|
470
483
|
"X-Open-edX-Component-Version-Uuid": component_version.uuid,
|
|
471
|
-
"X-Open-edX-Component-Version-Num": component_version.version_num,
|
|
484
|
+
"X-Open-edX-Component-Version-Num": str(component_version.version_num),
|
|
472
485
|
# Learning Package
|
|
473
486
|
"X-Open-edX-Learning-Package-Key": learning_package.key,
|
|
474
487
|
"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
|
|
@@ -85,6 +85,7 @@ class PublishableEntityAdmin(ReadOnlyModelAdmin):
|
|
|
85
85
|
"learning_package",
|
|
86
86
|
"created",
|
|
87
87
|
"created_by",
|
|
88
|
+
"can_stand_alone",
|
|
88
89
|
]
|
|
89
90
|
list_filter = ["learning_package"]
|
|
90
91
|
search_fields = ["key", "uuid"]
|
|
@@ -98,6 +99,7 @@ class PublishableEntityAdmin(ReadOnlyModelAdmin):
|
|
|
98
99
|
"created",
|
|
99
100
|
"created_by",
|
|
100
101
|
"see_also",
|
|
102
|
+
"can_stand_alone",
|
|
101
103
|
]
|
|
102
104
|
readonly_fields = [
|
|
103
105
|
"key",
|
|
@@ -108,6 +110,7 @@ class PublishableEntityAdmin(ReadOnlyModelAdmin):
|
|
|
108
110
|
"created",
|
|
109
111
|
"created_by",
|
|
110
112
|
"see_also",
|
|
113
|
+
"can_stand_alone",
|
|
111
114
|
]
|
|
112
115
|
|
|
113
116
|
def get_queryset(self, request):
|