openedx-learning 0.17.0__py2.py3-none-any.whl → 0.18.0__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.0"
@@ -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.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
@@ -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: attrs
22
+ Requires-Dist: rules<4.0
21
23
  Requires-Dist: Django<5.0
22
24
  Requires-Dist: djangorestframework<4.0
23
25
  Requires-Dist: edx-drf-extensions
24
- Requires-Dist: attrs
25
26
  Requires-Dist: celery
26
- Requires-Dist: rules<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=WQCJfrV8nUpwAaGx2NCUAw0d22YgqZqryjy0wIiV01M,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
@@ -37,7 +37,7 @@ openedx_learning/apps/authoring/contents/migrations/0001_initial.py,sha256=FtOTm
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
@@ -112,8 +112,8 @@ openedx_tagging/core/tagging/rest_api/v1/serializers.py,sha256=D7brBbgmU7MnbU7Ln
112
112
  openedx_tagging/core/tagging/rest_api/v1/urls.py,sha256=dNUKCtUCx_YzrwlbEbpDfjGVQbb2QdJ1VuJCkladj6E,752
113
113
  openedx_tagging/core/tagging/rest_api/v1/views.py,sha256=LA0EF7-p91JgVrLZpZaG474elKD1dswODGvoPIw47Mg,35837
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.0.dist-info/LICENSE.txt,sha256=QTW2QN7q3XszgUAXm9Dzgtu5LXYKbR1SGnqMa7ufEuY,35139
116
+ openedx_learning-0.18.0.dist-info/METADATA,sha256=0TzunzFQsdhZ0vYpqBy0XCsW02pFP0mACyskAekcA4w,8777
117
+ openedx_learning-0.18.0.dist-info/WHEEL,sha256=OpXWERl2xLPRHTvd2ZXo_iluPEQd8uSbYkJ53NAER_Y,109
118
+ openedx_learning-0.18.0.dist-info/top_level.txt,sha256=IYFbr5mgiEHd-LOtZmXj3q3a0bkGK1M9LY7GXgnfi4M,33
119
+ openedx_learning-0.18.0.dist-info/RECORD,,