Skip to content

v0.4.0 - Back with more goodies

Compare
Choose a tag to compare
@zerolab zerolab released this 06 Dec 11:18

This release brings Wagtail 2.7 compatibility and some much needed maintenance ❤️

Changelog

New template blocks

Hooks

The addition of the construct_media_chooser_queryset brings the wagtailmedia package one step closer to the core Wagtail documents/images behavious.

Called when rendering the media chooser view, to allow the media listing QuerySet to be customised. The callable passed into the hook will receive the current media QuerySet and the request object, and must return a Media QuerySet (either the original one, or a new one).

from wagtail.core import hooks

@hooks.register('construct_media_chooser_queryset')
def show_my_uploaded_media_only(media, request):
    # Only show uploaded media
    media = media.filter(uploaded_by_user=request.user)

    return media