Opened 8 years ago

Closed 8 years ago

#27224 closed Cleanup/optimization (invalid)

Is possible display SVG by help Django`s view?

Reported by: Seti Owned by: nobody
Component: Uncategorized Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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

Change History (1)

comment:1 by Tim Graham, 8 years ago

Resolution: invalid
Status: newclosed

Please see TicketClosingReasons/UseSupportChannels for ways to get help with usage questions.

Note: See TracTickets for help on using tickets.
Back to Top