openedx-learning 0.9.0__tar.gz → 0.9.2__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 (114) hide show
  1. {openedx-learning-0.9.0/openedx_learning.egg-info → openedx_learning-0.9.2}/PKG-INFO +5 -5
  2. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/__init__.py +1 -1
  3. {openedx-learning-0.9.0 → openedx_learning-0.9.2/openedx_learning.egg-info}/PKG-INFO +5 -5
  4. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning.egg-info/SOURCES.txt +1 -0
  5. openedx_learning-0.9.2/openedx_tagging/core/tagging/migrations/0017_alter_tagimporttask_status.py +18 -0
  6. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/models/import_export.py +7 -8
  7. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/rest_api/v1/serializers.py +9 -10
  8. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/rest_api/v1/views.py +65 -38
  9. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/CHANGELOG.rst +0 -0
  10. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/LICENSE.txt +0 -0
  11. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/MANIFEST.in +0 -0
  12. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/README.rst +0 -0
  13. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/contrib/__init__.py +0 -0
  14. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/contrib/media_server/__init__.py +0 -0
  15. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/contrib/media_server/apps.py +0 -0
  16. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/contrib/media_server/urls.py +0 -0
  17. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/contrib/media_server/views.py +0 -0
  18. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/__init__.py +0 -0
  19. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/components/__init__.py +0 -0
  20. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/components/admin.py +0 -0
  21. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/components/api.py +0 -0
  22. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/components/apps.py +0 -0
  23. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/components/migrations/0001_initial.py +0 -0
  24. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/components/migrations/0002_alter_componentversioncontent_key.py +0 -0
  25. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/components/migrations/__init__.py +0 -0
  26. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/components/models.py +0 -0
  27. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/contents/__init__.py +0 -0
  28. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/contents/admin.py +0 -0
  29. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/contents/api.py +0 -0
  30. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/contents/apps.py +0 -0
  31. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/contents/migrations/0001_initial.py +0 -0
  32. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/contents/migrations/__init__.py +0 -0
  33. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/contents/models.py +0 -0
  34. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/publishing/__init__.py +0 -0
  35. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/publishing/admin.py +0 -0
  36. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/publishing/api.py +0 -0
  37. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/publishing/apps.py +0 -0
  38. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/publishing/migrations/0001_initial.py +0 -0
  39. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/publishing/migrations/0002_alter_learningpackage_key_and_more.py +0 -0
  40. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/publishing/migrations/__init__.py +0 -0
  41. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/publishing/model_mixins.py +0 -0
  42. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/core/publishing/models.py +0 -0
  43. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/lib/__init__.py +0 -0
  44. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/lib/admin_utils.py +0 -0
  45. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/lib/cache.py +0 -0
  46. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/lib/collations.py +0 -0
  47. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/lib/fields.py +0 -0
  48. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/lib/managers.py +0 -0
  49. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/lib/test_utils.py +0 -0
  50. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/lib/validators.py +0 -0
  51. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/py.typed +0 -0
  52. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/rest_api/__init__.py +0 -0
  53. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/rest_api/apps.py +0 -0
  54. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/rest_api/urls.py +0 -0
  55. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/rest_api/v1/__init__.py +0 -0
  56. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/rest_api/v1/components.py +0 -0
  57. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning/rest_api/v1/urls.py +0 -0
  58. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning.egg-info/dependency_links.txt +0 -0
  59. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning.egg-info/not-zip-safe +0 -0
  60. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning.egg-info/requires.txt +4 -4
  61. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_learning.egg-info/top_level.txt +0 -0
  62. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/__init__.py +0 -0
  63. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/__init__.py +0 -0
  64. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/__init__.py +0 -0
  65. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/admin.py +0 -0
  66. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/api.py +0 -0
  67. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/apps.py +0 -0
  68. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/data.py +0 -0
  69. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/import_export/__init__.py +0 -0
  70. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/import_export/actions.py +0 -0
  71. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/import_export/api.py +0 -0
  72. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/import_export/exceptions.py +0 -0
  73. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/import_export/import_plan.py +0 -0
  74. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/import_export/parsers.py +0 -0
  75. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/import_export/tasks.py +0 -0
  76. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/import_export/template.csv +0 -0
  77. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/import_export/template.json +0 -0
  78. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0001_initial.py +0 -0
  79. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0001_squashed.py +0 -0
  80. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0002_auto_20230718_2026.py +0 -0
  81. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0003_auto_20230721_1238.py +0 -0
  82. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0004_auto_20230723_2001.py +0 -0
  83. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0005_language_taxonomy.py +0 -0
  84. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0006_alter_objecttag_unique_together.py +0 -0
  85. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0006_auto_20230802_1631.py +0 -0
  86. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0007_tag_import_task_log_null_fix.py +0 -0
  87. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0008_taxonomy_description_not_null.py +0 -0
  88. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0009_alter_objecttag_object_id.py +0 -0
  89. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0010_cleanups.py +0 -0
  90. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0011_remove_required.py +0 -0
  91. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0012_language_taxonomy.py +0 -0
  92. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0013_tag_parent_blank.py +0 -0
  93. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0014_minor_fixes.py +0 -0
  94. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0015_taxonomy_export_id.py +0 -0
  95. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/0016_object_tag_export_id.py +0 -0
  96. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/migrations/__init__.py +0 -0
  97. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/models/__init__.py +0 -0
  98. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/models/base.py +0 -0
  99. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/models/system_defined.py +0 -0
  100. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/models/utils.py +0 -0
  101. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/rest_api/__init__.py +0 -0
  102. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/rest_api/paginators.py +0 -0
  103. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/rest_api/urls.py +0 -0
  104. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/rest_api/utils.py +0 -0
  105. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/rest_api/v1/__init__.py +0 -0
  106. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/rest_api/v1/permissions.py +0 -0
  107. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/rest_api/v1/urls.py +0 -0
  108. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/rest_api/v1/views_import.py +0 -0
  109. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/rules.py +0 -0
  110. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/core/tagging/urls.py +0 -0
  111. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/openedx_tagging/py.typed +0 -0
  112. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/requirements/base.in +0 -0
  113. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/setup.cfg +0 -0
  114. {openedx-learning-0.9.0 → openedx_learning-0.9.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openedx-learning
3
- Version: 0.9.0
3
+ Version: 0.9.2
4
4
  Summary: An experiment.
5
5
  Home-page: https://github.com/openedx/openedx-learning
6
6
  Author: David Ormsbee
@@ -19,12 +19,12 @@ Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
20
  Requires-Python: >=3.8
21
21
  License-File: LICENSE.txt
22
- Requires-Dist: attrs
23
- Requires-Dist: Django<5.0
24
- Requires-Dist: edx-drf-extensions
25
- Requires-Dist: djangorestframework<4.0
26
22
  Requires-Dist: celery
27
23
  Requires-Dist: rules<4.0
24
+ Requires-Dist: attrs
25
+ Requires-Dist: djangorestframework<4.0
26
+ Requires-Dist: edx-drf-extensions
27
+ Requires-Dist: Django<5.0
28
28
 
29
29
  openedx-learning
30
30
  =============================
@@ -1,4 +1,4 @@
1
1
  """
2
2
  Open edX Learning ("Learning Core").
3
3
  """
4
- __version__ = "0.9.0"
4
+ __version__ = "0.9.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openedx-learning
3
- Version: 0.9.0
3
+ Version: 0.9.2
4
4
  Summary: An experiment.
5
5
  Home-page: https://github.com/openedx/openedx-learning
6
6
  Author: David Ormsbee
@@ -19,12 +19,12 @@ Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
20
  Requires-Python: >=3.8
21
21
  License-File: LICENSE.txt
22
- Requires-Dist: attrs
23
- Requires-Dist: Django<5.0
24
- Requires-Dist: edx-drf-extensions
25
- Requires-Dist: djangorestframework<4.0
26
22
  Requires-Dist: celery
27
23
  Requires-Dist: rules<4.0
24
+ Requires-Dist: attrs
25
+ Requires-Dist: djangorestframework<4.0
26
+ Requires-Dist: edx-drf-extensions
27
+ Requires-Dist: Django<5.0
28
28
 
29
29
  openedx-learning
30
30
  =============================
@@ -93,6 +93,7 @@ openedx_tagging/core/tagging/migrations/0013_tag_parent_blank.py
93
93
  openedx_tagging/core/tagging/migrations/0014_minor_fixes.py
94
94
  openedx_tagging/core/tagging/migrations/0015_taxonomy_export_id.py
95
95
  openedx_tagging/core/tagging/migrations/0016_object_tag_export_id.py
96
+ openedx_tagging/core/tagging/migrations/0017_alter_tagimporttask_status.py
96
97
  openedx_tagging/core/tagging/migrations/__init__.py
97
98
  openedx_tagging/core/tagging/models/__init__.py
98
99
  openedx_tagging/core/tagging/models/base.py
@@ -0,0 +1,18 @@
1
+ # Generated by Django 4.2.11 on 2024-04-05 06:58
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('oel_tagging', '0016_object_tag_export_id'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AlterField(
14
+ model_name='tagimporttask',
15
+ name='status',
16
+ field=models.CharField(choices=[('loading_data', 'Loading Data'), ('planning', 'Planning'), ('executing', 'Executing'), ('success', 'Success'), ('error', 'Error')], help_text='Task status', max_length=20),
17
+ ),
18
+ ]
@@ -3,7 +3,6 @@ Models used by the Taxonomy import/export tasks.
3
3
  """
4
4
 
5
5
  from datetime import datetime
6
- from enum import Enum
7
6
 
8
7
  from django.db import models
9
8
  from django.utils.translation import gettext as _
@@ -12,15 +11,15 @@ from django.utils.translation import gettext_lazy
12
11
  from .base import Taxonomy
13
12
 
14
13
 
15
- class TagImportTaskState(Enum):
14
+ class TagImportTaskState(models.TextChoices):
16
15
  """
17
16
  Enumerates the states that a TagImportTask can be in.
18
17
  """
19
- LOADING_DATA = "loading_data"
20
- PLANNING = "planning"
21
- EXECUTING = "executing"
22
- SUCCESS = "success"
23
- ERROR = "error"
18
+ LOADING_DATA = "loading_data", gettext_lazy("Loading Data")
19
+ PLANNING = "planning", gettext_lazy("Planning")
20
+ EXECUTING = "executing", gettext_lazy("Executing")
21
+ SUCCESS = "success", gettext_lazy("Success")
22
+ ERROR = "error", gettext_lazy("Error")
24
23
 
25
24
 
26
25
  class TagImportTask(models.Model):
@@ -42,7 +41,7 @@ class TagImportTask(models.Model):
42
41
 
43
42
  status = models.CharField(
44
43
  max_length=20,
45
- choices=[(status, status.value) for status in TagImportTaskState],
44
+ choices=TagImportTaskState.choices,
46
45
  help_text=gettext_lazy("Task status"),
47
46
  )
48
47
 
@@ -191,22 +191,21 @@ class ObjectTagsByTaxonomySerializer(UserPermissionsSerializerMixin, serializers
191
191
  return by_object
192
192
 
193
193
 
194
- class ObjectTagUpdateBodySerializer(serializers.Serializer): # pylint: disable=abstract-method
194
+ class ObjectTagUpdateByTaxonomySerializer(serializers.Serializer): # pylint: disable=abstract-method
195
195
  """
196
- Serializer of the body for the ObjectTag UPDATE view
196
+ Serializer of a taxonomy item of ObjectTag UPDATE view.
197
197
  """
198
-
198
+ taxonomy = serializers.PrimaryKeyRelatedField(
199
+ queryset=Taxonomy.objects.all(), required=True
200
+ )
199
201
  tags = serializers.ListField(child=serializers.CharField(), required=True)
200
202
 
201
203
 
202
- class ObjectTagUpdateQueryParamsSerializer(serializers.Serializer): # pylint: disable=abstract-method
204
+ class ObjectTagUpdateBodySerializer(serializers.Serializer): # pylint: disable=abstract-method
203
205
  """
204
- Serializer of the query params for the ObjectTag UPDATE view
206
+ Serializer of the body for the ObjectTag UPDATE view
205
207
  """
206
-
207
- taxonomy = serializers.PrimaryKeyRelatedField(
208
- queryset=Taxonomy.objects.all(), required=True
209
- )
208
+ tagsData = serializers.ListField(child=ObjectTagUpdateByTaxonomySerializer(), required=True)
210
209
 
211
210
 
212
211
  class TagDataSerializer(UserPermissionsSerializerMixin, serializers.Serializer): # pylint: disable=abstract-method
@@ -343,7 +342,7 @@ class TaxonomyImportNewBodySerializer(TaxonomyImportBodySerializer): # pylint:
343
342
  """
344
343
  taxonomy_name = serializers.CharField(required=True)
345
344
  taxonomy_description = serializers.CharField(default="")
346
- taxonomy_export_id = serializers.CharField(required=True)
345
+ taxonomy_export_id = serializers.CharField(required=False)
347
346
 
348
347
 
349
348
  class TagImportTaskSerializer(serializers.ModelSerializer):
@@ -40,7 +40,6 @@ from .serializers import (
40
40
  ObjectTagsByTaxonomySerializer,
41
41
  ObjectTagSerializer,
42
42
  ObjectTagUpdateBodySerializer,
43
- ObjectTagUpdateQueryParamsSerializer,
44
43
  TagDataSerializer,
45
44
  TaxonomyExportQueryParamsSerializer,
46
45
  TaxonomyImportBodySerializer,
@@ -305,12 +304,18 @@ class TaxonomyView(ModelViewSet):
305
304
  body.is_valid(raise_exception=True)
306
305
 
307
306
  taxonomy_name = body.validated_data["taxonomy_name"]
308
- taxonomy_export_id = body.validated_data["taxonomy_export_id"]
307
+ taxonomy_export_id = body.validated_data.get("taxonomy_export_id")
309
308
  taxonomy_description = body.validated_data["taxonomy_description"]
310
309
  file = body.validated_data["file"].file
311
310
  parser_format = body.validated_data["parser_format"]
312
311
 
313
- taxonomy = create_taxonomy(taxonomy_name, taxonomy_description, export_id=taxonomy_export_id)
312
+ # If no taxonomy_export_id provided, a unique export id will be generated
313
+ taxonomy = create_taxonomy(
314
+ taxonomy_name,
315
+ taxonomy_description,
316
+ export_id=taxonomy_export_id,
317
+ )
318
+
314
319
  try:
315
320
  import_success, task, _plan = import_tags(taxonomy, file, parser_format)
316
321
 
@@ -501,8 +506,8 @@ class ObjectTagView(
501
506
  Update ObjectTags that belong to a given object_id
502
507
 
503
508
  Pass a list of Tag ids or Tag values to be applied to an object id in the
504
- body `tag` parameter. Passing an empty list will remove all tags from
505
- the object id.
509
+ body `tag` parameter, by each taxonomy. Passing an empty list will remove all tags from
510
+ the object id on an specific taxonomy.
506
511
 
507
512
  **Example Body Requests**
508
513
 
@@ -511,54 +516,76 @@ class ObjectTagView(
511
516
  **Example Body Requests**
512
517
  ```json
513
518
  {
514
- "tags": [1, 2, 3]
519
+ "tagsData": [
520
+ {
521
+ "taxonomy": 1,
522
+ "tags": [1, 2, 3]
523
+ },
524
+ {
525
+ "taxonomy": 1,
526
+ "tags": [1, 2, 3]
527
+ }
528
+ ],
515
529
  },
516
530
  {
517
- "tags": ["Tag 1", "Tag 2"]
531
+ "tagsData": [
532
+ {
533
+ "taxonomy": 1,
534
+ "tags": ["Tag 1", "Tag 2"]
535
+ },
536
+ ]
518
537
  },
519
538
  {
520
- "tags": []
539
+ "tagsData": [
540
+ {
541
+ "taxonomy": 1,
542
+ "tags": []
543
+ },
544
+ ]
521
545
  }
522
546
  """
523
-
524
547
  partial = kwargs.pop('partial', False)
525
548
  if partial:
526
549
  raise MethodNotAllowed("PATCH", detail="PATCH not allowed")
527
550
 
528
- query_params = ObjectTagUpdateQueryParamsSerializer(
529
- data=request.query_params.dict()
530
- )
531
- query_params.is_valid(raise_exception=True)
532
- taxonomy = query_params.validated_data.get("taxonomy", None)
533
- taxonomy = taxonomy.cast()
534
-
551
+ object_id = kwargs.pop('object_id')
535
552
  perm = "oel_tagging.can_tag_object"
553
+ body = ObjectTagUpdateBodySerializer(data=request.data)
554
+ body.is_valid(raise_exception=True)
536
555
 
537
- object_id = kwargs.pop('object_id')
538
- perm_obj = ObjectTagPermissionItem(
539
- taxonomy=taxonomy,
540
- object_id=object_id,
541
- )
556
+ data = body.validated_data.get("tagsData", [])
542
557
 
543
- if not request.user.has_perm(
544
- perm,
545
- # The obj arg expects a model, but we are passing an object
546
- perm_obj, # type: ignore[arg-type]
547
- ):
548
- raise PermissionDenied(
549
- "You do not have permission to change object tags for this taxonomy or object_id."
550
- )
558
+ if not data:
559
+ return self.retrieve(request, object_id)
551
560
 
552
- body = ObjectTagUpdateBodySerializer(data=request.data)
553
- body.is_valid(raise_exception=True)
561
+ # Check permissions
562
+ for tagsData in data:
563
+ taxonomy = tagsData.get("taxonomy")
554
564
 
555
- tags = body.data.get("tags", [])
556
- try:
557
- tag_object(object_id, taxonomy, tags)
558
- except TagDoesNotExist as e:
559
- raise ValidationError from e
560
- except ValueError as e:
561
- raise ValidationError from e
565
+ perm_obj = ObjectTagPermissionItem(
566
+ taxonomy=taxonomy,
567
+ object_id=object_id,
568
+ )
569
+ if not request.user.has_perm(
570
+ perm,
571
+ # The obj arg expects a model, but we are passing an object
572
+ perm_obj, # type: ignore[arg-type]
573
+ ):
574
+ raise PermissionDenied(f"""
575
+ You do not have permission to change object tags
576
+ for Taxonomy: {str(taxonomy)} or Object: {object_id}.
577
+ """)
578
+
579
+ # Tag object_id per taxonomy
580
+ for tagsData in data:
581
+ taxonomy = tagsData.get("taxonomy")
582
+ tags = tagsData.get("tags", [])
583
+ try:
584
+ tag_object(object_id, taxonomy, tags)
585
+ except TagDoesNotExist as e:
586
+ raise ValidationError from e
587
+ except ValueError as e:
588
+ raise ValidationError from e
562
589
 
563
590
  return self.retrieve(request, object_id)
564
591
 
@@ -1,6 +1,6 @@
1
- attrs
2
- Django<5.0
3
- edx-drf-extensions
4
- djangorestframework<4.0
5
1
  celery
6
2
  rules<4.0
3
+ attrs
4
+ djangorestframework<4.0
5
+ edx-drf-extensions
6
+ Django<5.0