Skip to content

Conversation

@ahosgood
Copy link

@ahosgood ahosgood commented Apr 17, 2025

Fixes #254 and introduces parity with the main Wagtail images model (https://github.com/wagtail/wagtail/blob/main/wagtail/images/models.py)

@ahosgood ahosgood changed the title Add full_url field and update download_url format in media API (fixes #254) Apr 17, 2025
@zerolab
Copy link
Member

zerolab commented May 6, 2025

Thank you for this @ahosgood.
Will aim to review and test it in the coming weeks.

Note to self: this would constitute a breaking change, so need to higlight in release notes

@zerolab
Copy link
Member

zerolab commented Sep 16, 2025

Having thought of this, download_url is full_url, so I suggest we use full_url under the hood, and we'll add a deprecation notice for the download_url.

Since the aim is to be consistent with the core attributes, can you please add a url property that returns the relative path (core: https://github.com/wagtail/wagtail/blob/main/wagtail/images/models.py#L1332-L1334), which is what currently download_url does in your PR

@ahosgood
Copy link
Author

Having thought of this, download_url is full_url, so I suggest we use full_url under the hood, and we'll add a deprecation notice for the download_url.

Since the aim is to be consistent with the core attributes, can you please add a url property that returns the relative path (core: https://github.com/wagtail/wagtail/blob/main/wagtail/images/models.py#L1332-L1334), which is what currently download_url does in your PR

@zerolab - I'm sorry, you might have to explain a little more.

At the moment, I'm seeing this in the image API detail endpoint which is the structure I tried to copy:

{
    "id": 1,
    "meta": {
        "type": "wagtailimages.Image",
        "detail_url": "http://localhost:8000/api/v2/images/1/",
        "tags": [],
        "download_url": "/media/original_images/my_image.jpg"
    },
    "title": "Foobar",
    "width": 1920,
    "height": 1080
}

There is a download_url but no url field. If we want parity, wouldn't we want to keep download_url?

I'm working on Wagtail 6.x though - maybe something has changed in Wagtail 7?

@zerolab zerolab force-pushed the main branch 4 times, most recently from ddccf3a to b39f564 Compare October 18, 2025 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants