Fixes: 1) Corrected download attribute check with hasattr to prevent potential AttributeError;
Extra: n/a;
This commit is contained in:
parent
9ad79f0c5e
commit
6fe1664d57
1 changed files with 1 additions and 1 deletions
|
|
@ -1784,7 +1784,7 @@ class OrderProduct(ExportModelOperationsMixin("order_product"), NiceModel): # t
|
||||||
def download_url(self: Self) -> str:
|
def download_url(self: Self) -> str:
|
||||||
if self.product and self.product.stocks:
|
if self.product and self.product.stocks:
|
||||||
if self.product.is_digital and self.product.stocks.first().digital_asset: # type: ignore [union-attr]
|
if self.product.is_digital and self.product.stocks.first().digital_asset: # type: ignore [union-attr]
|
||||||
if self.download:
|
if hasattr(self, download):
|
||||||
return self.download.url
|
return self.download.url
|
||||||
else:
|
else:
|
||||||
return DigitalAssetDownload.objects.create(order_product=self).url
|
return DigitalAssetDownload.objects.create(order_product=self).url
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue