From 752b61a852ddb5da83680c7594699a6ae8f4212f Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 25 Dec 2019 22:33:56 +0530 Subject: [PATCH] Correct the way to get the first object --- datacenterlight/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datacenterlight/utils.py b/datacenterlight/utils.py index f65f3588..5272ef20 100644 --- a/datacenterlight/utils.py +++ b/datacenterlight/utils.py @@ -138,7 +138,7 @@ def validate_vat_number(stripe_customer_id, vat_number): logger.debug("BillingAddress does not exist for %s" % vat_number) except BillingAddress.MultipleObjectsReturned as mor: logger.debug("Multiple BillingAddress exist for %s" % vat_number) - billing_address = BillingAddress.objects.last(vat_number=vat_number) + billing_address = BillingAddress.objects.all(vat_number=vat_number).order_by('-id').first() if billing_address is not None: if billing_address.vat_number_validated_on: return {