You probably also need to use the "safe" filter, {{variable_name|safe}}.
Antonis Christofides http://djangodeployment.com
On 2017-09-02 09:28, James Schneider wrote:
--
On Sep 1, 2017 5:05 PM, "Ahmed Ablak" <ahmedablak0@gmail.com> wrote:
Hello,
I am using Django and have an expensive computing process that takes about 12 or 13 hours and generates javascript charts.
When you say JS charts, are you simply referring to data sets, or actual JS that includes your data sets?
JS code will not show when properly identified as JS code. Without surrounding it in <script> tags, the browser will take your code as plain text content and display it rather than interpreting it as JS code.I did the computing using the management command and stored the charts in the models as TextField.
My question is how to display this javascript code on the template? using
results in plain javascript text{{ variable_name }}
and using
<script type="javascript"> {{ variable_name}} </script>
results in hidden text with special characters.
That's step one. Step two is adding a function to execute the code you've provided with other functions. Without knowing what code you are generating, I can't say for sure what you need.
-James
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciX6e72%3DYLuPtKURvsGHq2MgAsNwCN9gaXWLv%2BWZ%2BbenDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment