Fixes: 1) Corrected download attribute check with hasattr to prevent potential AttributeError;

Extra: n/a;
This commit is contained in:
Egor Pavlovich Gorbunov 2025-10-03 17:37:20 +03:00
parent 9ad79f0c5e
commit 6fe1664d57

View file

@ -1784,7 +1784,7 @@ class OrderProduct(ExportModelOperationsMixin("order_product"), NiceModel): # t
def download_url(self: Self) -> str:
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.download:
if hasattr(self, download):
return self.download.url
else:
return DigitalAssetDownload.objects.create(order_product=self).url