How to use the wagtailmedia.widgets.AdminMediaChooser function in wagtailmedia

To help you get started, we’ve selected a few wagtailmedia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github torchbox / wagtailmedia / wagtailmedia / blocks.py View on Github external
def widget(self):
        from wagtailmedia.widgets import AdminMediaChooser
        return AdminMediaChooser
github torchbox / wagtailmedia / wagtailmedia / widgets.py View on Github external
def render_html(self, name, value, attrs):
        instance, value = self.get_instance_and_id(self.media_model, value)
        original_field_html = super(AdminMediaChooser, self).render_html(name, value, attrs)

        return render_to_string('wagtailmedia/widgets/media_chooser.html', {
            'widget': self,
            'original_field_html': original_field_html,
            'attrs': attrs,
            'value': value,
            'media': instance,
        })
github torchbox / wagtailmedia / wagtailmedia / edit_handlers.py View on Github external
def widget_overrides(self):
        return {self.field_name: AdminMediaChooser}