openedx-learning 0.17.0__py2.py3-none-any.whl → 0.18.1__py2.py3-none-any.whl

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.
@@ -2,4 +2,4 @@
2
2
  Open edX Learning ("Learning Core").
3
3
  """
4
4
 
5
- __version__ = "0.17.0"
5
+ __version__ = "0.18.1"
@@ -267,11 +267,7 @@ class Content(models.Model):
267
267
  # only in file form. It is an error for ``text`` to be None and ``has_file``
268
268
  # to be False, since that would mean we haven't stored data anywhere at all.
269
269
  #
270
- # We annotate this because mypy doesn't recognize that ``text`` should be
271
- # nullable when using MultiCollationTextField, but does the right thing for
272
- # TextField. For more info, see:
273
- # https://github.com/openedx/openedx-learning/issues/152
274
- text: models.TextField[str | None, str | None] = MultiCollationTextField(
270
+ text = MultiCollationTextField(
275
271
  blank=True,
276
272
  null=True,
277
273
  max_length=MAX_TEXT_LENGTH,
@@ -50,6 +50,7 @@ __all__ = [
50
50
  "soft_delete_draft",
51
51
  "reset_drafts_to_published",
52
52
  "register_content_models",
53
+ "filter_publishable_entities",
53
54
  ]
54
55
 
55
56
 
@@ -493,3 +494,22 @@ def register_content_models(
493
494
  return PublishableContentModelRegistry.register(
494
495
  content_model_cls, content_version_model_cls
495
496
  )
497
+
498
+
499
+ def filter_publishable_entities(
500
+ entities: QuerySet[PublishableEntity],
501
+ has_draft=None,
502
+ has_published=None
503
+ ) -> QuerySet[PublishableEntity]:
504
+ """
505
+ Filter an entities query set.
506
+
507
+ has_draft: You can filter by entities that has a draft or not.
508
+ has_published: You can filter by entities that has a published version or not.
509
+ """
510
+ if has_draft is not None:
511
+ entities = entities.filter(draft__version__isnull=not has_draft)
512
+ if has_published is not None:
513
+ entities = entities.filter(published__version__isnull=not has_published)
514
+
515
+ return entities
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openedx-learning
3
- Version: 0.17.0
3
+ Version: 0.18.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,12 +18,12 @@ 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: Django<5.0
22
- Requires-Dist: djangorestframework<4.0
23
- Requires-Dist: edx-drf-extensions
24
21
  Requires-Dist: attrs
25
22
  Requires-Dist: celery
23
+ Requires-Dist: Django<5.0
26
24
  Requires-Dist: rules<4.0
25
+ Requires-Dist: edx-drf-extensions
26
+ Requires-Dist: djangorestframework<4.0
27
27
 
28
28
  Open edX Learning Core (and Tagging)
29
29
  ====================================
@@ -1,4 +1,4 @@
1
- openedx_learning/__init__.py,sha256=IMpdIFxhnSJC8rI3HtW2SRy57WekVbE3qOwH-dTdmnw,69
1
+ openedx_learning/__init__.py,sha256=e94qKf1zR9la6hClqpjVg7BcDFrKfZDs8fMoFBOVHHY,69
2
2
  openedx_learning/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  openedx_learning/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  openedx_learning/api/authoring.py,sha256=vbRpiQ2wOfN3oR2bbN0-bI2ra0QRtha9tVixKW1ENis,929
@@ -32,12 +32,12 @@ openedx_learning/apps/authoring/contents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
32
32
  openedx_learning/apps/authoring/contents/admin.py,sha256=9Njd_lje1emcd168KBWUTGf0mVJ6K-dMYMcqHNjRU4k,1761
33
33
  openedx_learning/apps/authoring/contents/api.py,sha256=bXb9yQjPfoP1Ynf1aAYz3BEPffK7H5cnba6KdPFSiG0,8818
34
34
  openedx_learning/apps/authoring/contents/apps.py,sha256=EEUZEnww7TcYcyxMovZthG2muNxd7j7nxBIf21gKrp4,398
35
- openedx_learning/apps/authoring/contents/models.py,sha256=RobNGdqkFhChcpub9FszOeqft4c1TJQgS5vQ3Cp2NCA,17899
35
+ openedx_learning/apps/authoring/contents/models.py,sha256=AG3U00TPEjshngBdBhC_qCTF_dPcQMEmjmzW9pjA4BU,17599
36
36
  openedx_learning/apps/authoring/contents/migrations/0001_initial.py,sha256=FtOTmIGX2KHpjw-PHbfRjxkFEomI5CEDhNKCZ7IpFeE,3060
37
37
  openedx_learning/apps/authoring/contents/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  openedx_learning/apps/authoring/publishing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  openedx_learning/apps/authoring/publishing/admin.py,sha256=F-0QlVQmuovLIF258XK_vKJdOnn7lLa_0A5veE72TKc,4830
40
- openedx_learning/apps/authoring/publishing/api.py,sha256=CbJ8bvUGbN879JMX29auLfHeTQ_CotA6n868qglyaPM,16845
40
+ openedx_learning/apps/authoring/publishing/api.py,sha256=dawwRDbqbA_02xtPAwFIukWShrkO6MoQptmEKdAN7uA,17475
41
41
  openedx_learning/apps/authoring/publishing/apps.py,sha256=jUfd78xvXaZg3dwkqXihatbeajJGm3Uz1rJpuyd-3g0,402
42
42
  openedx_learning/apps/authoring/publishing/model_mixins.py,sha256=DGM6cZSNX4KZHy5xWtNy6yO4bRT04VDus8yZJ4v3vI0,14447
43
43
  openedx_learning/apps/authoring/publishing/models.py,sha256=ImMAujPDc2-CECZw_yvVlUOdtGYwmt99TJ2r1HJkkV8,20488
@@ -110,10 +110,10 @@ openedx_tagging/core/tagging/rest_api/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
110
110
  openedx_tagging/core/tagging/rest_api/v1/permissions.py,sha256=7HPE_NuKku_ISnkeE_HsFNXVYt0IbVkJN6M4wqwHGHU,2443
111
111
  openedx_tagging/core/tagging/rest_api/v1/serializers.py,sha256=D7brBbgmU7MnbU7Ln_xiLG-TtXno0aciE5AhjsXlClE,13903
112
112
  openedx_tagging/core/tagging/rest_api/v1/urls.py,sha256=dNUKCtUCx_YzrwlbEbpDfjGVQbb2QdJ1VuJCkladj6E,752
113
- openedx_tagging/core/tagging/rest_api/v1/views.py,sha256=LA0EF7-p91JgVrLZpZaG474elKD1dswODGvoPIw47Mg,35837
113
+ openedx_tagging/core/tagging/rest_api/v1/views.py,sha256=IREy15_3u_TzUcxnoXCh3f84wA_QKUmU0WN958MJKxY,35923
114
114
  openedx_tagging/core/tagging/rest_api/v1/views_import.py,sha256=kbHUPe5A6WaaJ3J1lFIcYCt876ecLNQfd19m7YYub6c,1470
115
- openedx_learning-0.17.0.dist-info/LICENSE.txt,sha256=QTW2QN7q3XszgUAXm9Dzgtu5LXYKbR1SGnqMa7ufEuY,35139
116
- openedx_learning-0.17.0.dist-info/METADATA,sha256=m44VGrMwjZ7BC1hHVgyx3lA-0jUYasgctFJ4WxswbNU,8777
117
- openedx_learning-0.17.0.dist-info/WHEEL,sha256=OpXWERl2xLPRHTvd2ZXo_iluPEQd8uSbYkJ53NAER_Y,109
118
- openedx_learning-0.17.0.dist-info/top_level.txt,sha256=IYFbr5mgiEHd-LOtZmXj3q3a0bkGK1M9LY7GXgnfi4M,33
119
- openedx_learning-0.17.0.dist-info/RECORD,,
115
+ openedx_learning-0.18.1.dist-info/LICENSE.txt,sha256=QTW2QN7q3XszgUAXm9Dzgtu5LXYKbR1SGnqMa7ufEuY,35139
116
+ openedx_learning-0.18.1.dist-info/METADATA,sha256=sRm1pUlIfUuXpiEXk-rSdvjRtgPQ4nIw9D4jL4b0g40,8777
117
+ openedx_learning-0.18.1.dist-info/WHEEL,sha256=0VNUDWQJzfRahYI3neAhz2UVbRCtztpN5dPHAGvmGXc,109
118
+ openedx_learning-0.18.1.dist-info/top_level.txt,sha256=IYFbr5mgiEHd-LOtZmXj3q3a0bkGK1M9LY7GXgnfi4M,33
119
+ openedx_learning-0.18.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.5.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any
@@ -450,6 +450,7 @@ class ObjectTagView(
450
450
  minimal_serializer_class = ObjectTagMinimalSerializer
451
451
  permission_classes = [ObjectTagObjectPermissions]
452
452
  lookup_field = "object_id"
453
+ lookup_value_regex = r'[\w\.\+\-@:]+'
453
454
 
454
455
  def get_queryset(self) -> models.QuerySet:
455
456
  """
@@ -619,6 +620,7 @@ class ObjectTagCountsView(
619
620
 
620
621
  serializer_class = ObjectTagSerializer
621
622
  lookup_field = "object_id_pattern"
623
+ lookup_value_regex = r'[\w\.\+\-@:*,]+'
622
624
 
623
625
  def retrieve(self, request, *args, **kwargs) -> Response:
624
626
  """