Skip to content

Commit

Permalink
checks if expression_frbr_uri exists
Browse files Browse the repository at this point in the history
  • Loading branch information
actlikewill committed Mar 5, 2024
1 parent aeb5947 commit 7eb2c83
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions peachjam/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,13 @@ def get_queryset(self):
return self._meta.model.objects.get_qs_no_defer()

def dehydrate_download_url(self, obj):
download_source = reverse(
"document_source", kwargs={"frbr_uri": obj.expression_frbr_uri[1:]}
)
scheme = "https"
return f"{scheme}://{self.domain}{download_source}"
if obj.expression_frbr_uri:
download_source = reverse(
"document_source", kwargs={"frbr_uri": obj.expression_frbr_uri[1:]}
)
scheme = "https"
return f"{scheme}://{self.domain}{download_source}"
return ""

class Meta:
exclude = (
Expand Down

0 comments on commit 7eb2c83

Please sign in to comment.