diff --git a/openedx_learning/apps/authoring/publishing/api.py b/openedx_learning/apps/authoring/publishing/api.py index 2d523377..863c8e0f 100644 --- a/openedx_learning/apps/authoring/publishing/api.py +++ b/openedx_learning/apps/authoring/publishing/api.py @@ -216,10 +216,16 @@ def get_all_drafts(learning_package_id: int, /) -> QuerySet[Draft]: ) -def get_entities_with_unpublished_changes(learning_package_id: int, /) -> QuerySet[PublishableEntity]: +def get_entities_with_unpublished_changes( + learning_package_id: int, + /, + include_deleted_drafts: bool = False +) -> QuerySet[PublishableEntity]: return PublishableEntity.objects \ - .filter(learning_package_id=learning_package_id) \ - .exclude(draft__version=F('published__version')) + .filter( + learning_package_id=learning_package_id, + draft__version__isnull=include_deleted_drafts, + ).exclude(draft__version=F('published__version')) def get_entities_with_unpublished_deletes(learning_package_id: int, /) -> QuerySet[PublishableEntity]: