Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion grapple/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,10 @@ def get_media_item_url(cls):
url = cls.file.url

if url[0] == "/":
return settings.BASE_URL + url
if hasattr(settings, "WAGTAILADMIN_BASE_URL"):
return settings.WAGTAILADMIN_BASE_URL + url
elif hasattr(settings, "BASE_URL"):
return settings.BASE_URL + url
Comment on lines +282 to +285
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the variable name was changed in Wagtail 3.0, we can probably drop support for BASE_URL. @zerolab agree?

return url


Expand Down
6 changes: 3 additions & 3 deletions tests/test_blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def test_blog_body_imagechooserblock(self):
)
self.assertEqual(
query_blocks[count]["image"]["src"],
settings.BASE_URL + block.value.file.url,
settings.WAGTAILADMIN_BASE_URL + block.value.file.url,
)
# Increment the count
count += 1
Expand Down Expand Up @@ -370,7 +370,7 @@ def test_blog_body_imageblock(self):
)
self.assertEqual(
query_blocks[count]["image"]["src"],
settings.BASE_URL + block.value.file.url,
settings.WAGTAILADMIN_BASE_URL + block.value.file.url,
)
self.assertEqual(
query_blocks[count]["decorative"], block.value.decorative
Expand Down Expand Up @@ -487,7 +487,7 @@ def test_blog_body_imagegalleryblock(self):
)
self.assertEqual(
image["image"]["src"],
settings.BASE_URL
settings.WAGTAILADMIN_BASE_URL
+ str(block.value["images"][key].value["image"].file.url),
)
# Increment the count
Expand Down