def render_js(self): client_asset = self.get_client_asset() if client_asset: client_bundle = mark_safe(WebpackBundle.render_tag(client_asset['url'])) return mark_safe( '\n{bundle}\n<script>\n{mount_js}\n</script>\n'.format( bundle=client_bundle, mount_js=self.render_mount_js(), ) )
def render_js(self): return mark_safe( '\n{bundle}\n<script>\n{mount_js}\n</script>\n'.format( bundle=self.get_bundle(), mount_js=self.render_mount_js(), ) )
def render_mount_js(self): return mark_safe( MOUNT_JS.format( var=self.get_var(), props=self.serialized_props or 'null', container_id=self.get_container_id() ) )
def render(self): """ Returns HTML script elements pointing to the bundle's assets """ urls = self.get_urls() if urls: return mark_safe(''.join([self.render_tag(url) for url in urls])) return ''
def render_markup(self): markup = self.markup if self.bundle and not self.to_static_markup: template = '<span id="{id}">{markup}</span>' if six.PY2: template = unicode(template) markup = template.format( id=self.get_container_id(), markup=markup, ) return mark_safe(markup)
def render_props(self): if self.serialized_props: return mark_safe(self.serialized_props) return ''
def __unicode__(self): return mark_safe(unicode(self.render_markup()))
def __str__(self): return mark_safe(self.render_markup())
def __unicode__(self): return mark_safe(unicode(self.render()))
def __str__(self): return mark_safe(self.render())
def test_mark_safe_is_available(self): from django.utils.safestring import mark_safe as _mark_safe self.assertEqual(mark_safe, _mark_safe) string = 'foo' self.assertEqual(mark_safe(string), string)
def render_js(self): return mark_safe( '\n{bundle}\n<script>\n{mount_js}\n</script>\n'.format( bundle=self.get_bundle(), mount_js=self.render_mount_js(), ))
def render_mount_js(self): return mark_safe( MOUNT_JS.format(var=self.get_var(), props=self.serialized_props or 'null', container_id=self.get_container_id()))