#27224: Is possible display SVG by help Django`s view?
--------------------------------------+--------------------
     Reporter:  setivolkylany         |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  Uncategorized         |    Version:  1.10
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+--------------------
 My variable for SVG is next: https://dpaste.de/cPpP

 I tried display that code in through view as next



 {{{
 # my SVG variable
 return mark_safe(svg)
 }}}


 Result:
  XML is escaped (mark_safe did not work)

 and next


 {{{
 # my SVG variable
 format_html('{}', svg)
 }}}


 Errors from Chrome`s console:
  (index):-1 Uncaught SyntaxError: Invalid or unexpected token
 and next


 {{{
 # my SVG variable
 format_html('{}', mark_safe(svg))
 }}}


 Errors from Chrome`s console:
  (index):-1 Uncaught SyntaxError: Invalid or unexpected token

 and next


 {{{
 # my SVG variable
 return mark_safe(Template('{{ svg|safe }}').render(Context({'svg': svg})))
 }}}

 return format_html('{}', svg)
 Errors from Chrome`s console:
  (index):318 Uncaught SyntaxError: Unexpected token <
  pygal-tooltips.min.js:2 Uncaught TypeError: t.addEventListener is not a
 function

 and next

 {{{
 # my SVG variable
 svg = mark_safe(Template('{{ svg|safe }}').render(Context({'svg': svg})))
 return format_html('{}', svg)
 }}}

 Errors from Chrome`s console:
  (index):318 Uncaught SyntaxError: Unexpected token <
  pygal-tooltips.min.js:2 Uncaught TypeError: t.addEventListener is not a
 function

--
Ticket URL: <https://code.djangoproject.com/ticket/27224>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/056.c799a007e97f8a7e06347a96ff01e86f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to