From 66f732744f73866f05d76379e109d11a9ab1165a Mon Sep 17 00:00:00 2001 From: Navin Karkera Date: Wed, 7 Aug 2024 15:42:09 +0530 Subject: [PATCH] fix: exclude deleted drafts while publishing Exclude draft entities with `null` version while publishing. --- openedx_learning/apps/authoring/publishing/api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openedx_learning/apps/authoring/publishing/api.py b/openedx_learning/apps/authoring/publishing/api.py index 2d523377..de067272 100644 --- a/openedx_learning/apps/authoring/publishing/api.py +++ b/openedx_learning/apps/authoring/publishing/api.py @@ -218,8 +218,10 @@ def get_all_drafts(learning_package_id: int, /) -> QuerySet[Draft]: def get_entities_with_unpublished_changes(learning_package_id: int, /) -> 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=False, + ).exclude(draft__version=F('published__version')) def get_entities_with_unpublished_deletes(learning_package_id: int, /) -> QuerySet[PublishableEntity]: