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.
Files changed (142) hide show
  1. {openedx_learning-0.18.2/openedx_learning.egg-info → openedx_learning-0.19.0}/PKG-INFO +2 -2
  2. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/__init__.py +1 -1
  3. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/api/authoring.py +1 -0
  4. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/api/authoring_models.py +1 -1
  5. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/api.py +3 -3
  6. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/apps.py +1 -1
  7. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/models.py +9 -14
  8. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/models.py +1 -1
  9. openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/api.py +971 -0
  10. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/publishing/apps.py +9 -0
  11. openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/migrations/0003_containers.py +54 -0
  12. openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/models/__init__.py +27 -0
  13. openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/models/container.py +70 -0
  14. openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/models/draft_published.py +95 -0
  15. openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/models/entity_list.py +69 -0
  16. openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/models/learning_package.py +75 -0
  17. openedx_learning-0.19.0/openedx_learning/apps/authoring/publishing/models/publish_log.py +106 -0
  18. 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
  19. openedx_learning-0.19.0/openedx_learning/apps/authoring/units/api.py +290 -0
  20. openedx_learning-0.19.0/openedx_learning/apps/authoring/units/apps.py +25 -0
  21. openedx_learning-0.19.0/openedx_learning/apps/authoring/units/migrations/0001_initial.py +36 -0
  22. openedx_learning-0.19.0/openedx_learning/apps/authoring/units/models.py +50 -0
  23. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/contrib/media_server/apps.py +1 -1
  24. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/managers.py +7 -1
  25. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/validators.py +1 -1
  26. {openedx_learning-0.18.2 → openedx_learning-0.19.0/openedx_learning.egg-info}/PKG-INFO +2 -2
  27. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning.egg-info/SOURCES.txt +14 -2
  28. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/api.py +11 -4
  29. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/models/base.py +1 -1
  30. openedx_learning-0.19.0/openedx_tagging/core/tagging/rest_api/v1/__init__.py +0 -0
  31. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/v1/permissions.py +1 -1
  32. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rules.py +1 -2
  33. openedx_learning-0.19.0/openedx_tagging/py.typed +0 -0
  34. openedx_learning-0.18.2/openedx_learning/apps/authoring/publishing/api.py +0 -515
  35. openedx_learning-0.18.2/openedx_learning/apps/authoring/publishing/models.py +0 -517
  36. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/CHANGELOG.rst +0 -0
  37. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/LICENSE.txt +0 -0
  38. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/MANIFEST.in +0 -0
  39. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/README.rst +0 -0
  40. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/api/__init__.py +0 -0
  41. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/__init__.py +0 -0
  42. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/__init__.py +0 -0
  43. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/__init__.py +0 -0
  44. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/admin.py +0 -0
  45. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/api.py +0 -0
  46. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/apps.py +0 -0
  47. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/migrations/0001_initial.py +0 -0
  48. {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
  49. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/migrations/0003_collection_entities.py +0 -0
  50. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/migrations/0004_collection_key.py +0 -0
  51. {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
  52. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/migrations/__init__.py +0 -0
  53. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/collections/models.py +0 -0
  54. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/__init__.py +0 -0
  55. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/admin.py +0 -0
  56. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/management/__init__.py +0 -0
  57. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/management/commands/__init__.py +0 -0
  58. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/management/commands/add_assets_to_component.py +0 -0
  59. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/migrations/0001_initial.py +0 -0
  60. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/migrations/0002_alter_componentversioncontent_key.py +0 -0
  61. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/migrations/0003_remove_componentversioncontent_learner_downloadable.py +0 -0
  62. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/components/migrations/__init__.py +0 -0
  63. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/__init__.py +0 -0
  64. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/admin.py +0 -0
  65. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/api.py +0 -0
  66. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/apps.py +0 -0
  67. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/migrations/0001_initial.py +0 -0
  68. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/contents/migrations/__init__.py +0 -0
  69. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/publishing/__init__.py +0 -0
  70. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/publishing/admin.py +0 -0
  71. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/publishing/migrations/0001_initial.py +0 -0
  72. {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
  73. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/apps/authoring/publishing/migrations/__init__.py +0 -0
  74. {openedx_learning-0.18.2/openedx_learning/contrib → openedx_learning-0.19.0/openedx_learning/apps/authoring/units}/__init__.py +0 -0
  75. {openedx_learning-0.18.2/openedx_learning/lib → openedx_learning-0.19.0/openedx_learning/apps/authoring/units/migrations}/__init__.py +0 -0
  76. {openedx_learning-0.18.2/openedx_tagging/core → openedx_learning-0.19.0/openedx_learning/contrib}/__init__.py +0 -0
  77. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/contrib/media_server/__init__.py +0 -0
  78. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/contrib/media_server/urls.py +0 -0
  79. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/contrib/media_server/views.py +0 -0
  80. {openedx_learning-0.18.2/openedx_tagging/core/tagging → openedx_learning-0.19.0/openedx_learning/lib}/__init__.py +0 -0
  81. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/admin_utils.py +0 -0
  82. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/cache.py +0 -0
  83. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/collations.py +0 -0
  84. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/fields.py +0 -0
  85. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/lib/test_utils.py +0 -0
  86. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning/py.typed +0 -0
  87. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning.egg-info/dependency_links.txt +0 -0
  88. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning.egg-info/not-zip-safe +0 -0
  89. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning.egg-info/requires.txt +1 -1
  90. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_learning.egg-info/top_level.txt +0 -0
  91. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/__init__.py +0 -0
  92. {openedx_learning-0.18.2/openedx_tagging/core/tagging/migrations → openedx_learning-0.19.0/openedx_tagging/core}/__init__.py +0 -0
  93. {openedx_learning-0.18.2/openedx_tagging/core/tagging/rest_api → openedx_learning-0.19.0/openedx_tagging/core/tagging}/__init__.py +0 -0
  94. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/admin.py +0 -0
  95. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/apps.py +0 -0
  96. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/data.py +0 -0
  97. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/__init__.py +0 -0
  98. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/actions.py +0 -0
  99. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/api.py +0 -0
  100. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/exceptions.py +0 -0
  101. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/import_plan.py +0 -0
  102. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/parsers.py +0 -0
  103. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/tasks.py +0 -0
  104. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/template.csv +0 -0
  105. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/import_export/template.json +0 -0
  106. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0001_initial.py +0 -0
  107. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0001_squashed.py +0 -0
  108. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0002_auto_20230718_2026.py +0 -0
  109. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0003_auto_20230721_1238.py +0 -0
  110. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0004_auto_20230723_2001.py +0 -0
  111. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0005_language_taxonomy.py +0 -0
  112. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0006_alter_objecttag_unique_together.py +0 -0
  113. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0006_auto_20230802_1631.py +0 -0
  114. {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
  115. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0008_taxonomy_description_not_null.py +0 -0
  116. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0009_alter_objecttag_object_id.py +0 -0
  117. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0010_cleanups.py +0 -0
  118. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0011_remove_required.py +0 -0
  119. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0012_language_taxonomy.py +0 -0
  120. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0013_tag_parent_blank.py +0 -0
  121. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0014_minor_fixes.py +0 -0
  122. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0015_taxonomy_export_id.py +0 -0
  123. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0016_object_tag_export_id.py +0 -0
  124. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0017_alter_tagimporttask_status.py +0 -0
  125. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/migrations/0018_objecttag_is_copied.py +0 -0
  126. {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
  127. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/models/__init__.py +0 -0
  128. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/models/import_export.py +0 -0
  129. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/models/system_defined.py +0 -0
  130. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/models/utils.py +0 -0
  131. /openedx_learning-0.18.2/openedx_tagging/py.typed → /openedx_learning-0.19.0/openedx_tagging/core/tagging/rest_api/__init__.py +0 -0
  132. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/paginators.py +0 -0
  133. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/urls.py +0 -0
  134. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/utils.py +0 -0
  135. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/v1/serializers.py +0 -0
  136. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/v1/urls.py +0 -0
  137. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/v1/views.py +0 -0
  138. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/rest_api/v1/views_import.py +0 -0
  139. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/openedx_tagging/core/tagging/urls.py +0 -0
  140. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/requirements/base.in +0 -0
  141. {openedx_learning-0.18.2 → openedx_learning-0.19.0}/setup.cfg +0 -0
  142. {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.18.2
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
@@ -2,4 +2,4 @@
2
2
  Open edX Learning ("Learning Core").
3
3
  """
4
4
 
5
- __version__ = "0.18.2"
5
+ __version__ = "0.19.0"
@@ -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
@@ -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,
@@ -14,7 +14,7 @@ class ComponentsConfig(AppConfig):
14
14
  default_auto_field = "django.db.models.BigAutoField"
15
15
  label = "oel_components"
16
16
 
17
- def ready(self):
17
+ def ready(self) -> None:
18
18
  """
19
19
  Register Component and ComponentVersion.
20
20
  """
@@ -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.model_mixins import PublishableEntityMixin, PublishableEntityVersionMixin
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): # type: ignore[django-manager-missing]
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
- # Tell mypy what type our objects manager has.
124
- # It's actually PublishableEntityMixinManager, but that has the exact same
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: models.Manager[Component] = WithRelationsManager(
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
@@ -121,7 +121,7 @@ class MediaType(models.Model):
121
121
  ),
122
122
  ]
123
123
 
124
- def __str__(self):
124
+ def __str__(self) -> str:
125
125
  base = f"{self.type}/{self.sub_type}"
126
126
  if self.suffix:
127
127
  return f"{base}+{self.suffix}"