Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add media support to PiccoloCRUD #169

Open
dantownsend opened this issue Aug 8, 2022 · 0 comments
Open

Add media support to PiccoloCRUD #169

dantownsend opened this issue Aug 8, 2022 · 0 comments
Labels
enhancement New feature or request Low priority Something which is nice to have, but not urgent.

Comments

@dantownsend
Copy link
Member

It would be good if we modified PiccoloCRUD, so it could accept a media_storage argument (like create_admin does in Piccolo Admin).

PiccoloCRUD(
    Movie,
    media_columns=[
        LocalMediaStorage(Movie.poster, media_path='/srv/media/movie_posters/')
    ]
)

We could then add a new GET parameter called something like __media_urls, which then auto adds the URL to the response for accessing the media.

GET /1/?__media_urls
{
    'id': 1,
    'name': 'Star Wars',
    'poster': 'some-file-abc-123.jpg',
    'poster_url': '/media/some-file-abc-123.jpg',
}

Once this is in place, we can refactor Piccolo Admin slightly, so it passes the media_storage argument to PiccoloCRUD, and lets PiccoloCRUD do all of the heavy lifting.

@dantownsend dantownsend added enhancement New feature or request Low priority Something which is nice to have, but not urgent. labels Aug 8, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request Low priority Something which is nice to have, but not urgent.
Projects
None yet
Development

No branches or pull requests

1 participant