From 22cc66eaf7c6d6acd8abdf229a1f0d4271f4b948 Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Fri, 8 Sep 2023 14:48:07 +0500 Subject: [PATCH] =?UTF-8?q?fix:=20in=20django42=20QuerySet.update=5For=5Fc?= =?UTF-8?q?reate()=20save=20only=20fields=20passed=20=E2=80=A6=20(#33174)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: in django42 QuerySet.update_or_create() save only fields passed in defaults --- .../commerce/management/commands/configure_commerce.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/commerce/management/commands/configure_commerce.py b/lms/djangoapps/commerce/management/commands/configure_commerce.py index fda5dce431..f849d85aeb 100644 --- a/lms/djangoapps/commerce/management/commands/configure_commerce.py +++ b/lms/djangoapps/commerce/management/commands/configure_commerce.py @@ -53,9 +53,11 @@ class Command(BaseCommand): checkout_on_ecommerce = options.get('checkout_on_ecommerce') # We are keeping id=1, because as of now, there are only one commerce configuration for the system. + pk_id = 1 CommerceConfiguration.objects.update_or_create( - id=1, + id=pk_id, defaults={ + 'id': pk_id, 'enabled': not disable, 'checkout_on_ecommerce_service': checkout_on_ecommerce, }