Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def widget(self):
from wagtailmedia.widgets import AdminMediaChooser
return AdminMediaChooser
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,
})
def widget_overrides(self):
return {self.field_name: AdminMediaChooser}