Correct the way to get the first object

This commit is contained in:
PCoder 2019-12-25 22:33:56 +05:30
parent 110459b38d
commit 752b61a852

View file

@ -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 {