Re: how to use django template language inside script html tag using django-jsRender

2020-04-03 Thread Antje Kazimiers
I think you can use some basic template language within a script block like
below. myData is a stringified json object, that worked for me.
antje


  {% if myData %}
var table_data = {{ myData|safe }};
  {% else %}
var table_data = null;
  {% endif %}



On Fri, Apr 3, 2020 at 4:00 PM Yacin Omar  wrote:

> As I know, there is no way to use Django template language inside
> Javascript block so I searched for a way how to do it, I found a Django app
> on github  called django-jsrender but unfortunately, there isn't enough
> documentation for this app and when I tried to use it I couldn't and this
> is my code:
>
> [image: Capture.PNG]
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a1c20606-bf66-4638-a006-be592a938c66%40googlegroups.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN6tUh%3DQ4Ueh%2B%2BHA-2PwmYpv0MwLhc%3DFKMiDt9jz1GeKgiKiWA%40mail.gmail.com.


how to use django template language inside script html tag using django-jsRender

2020-04-03 Thread Yacin Omar
As I know, there is no way to use Django template language inside 
Javascript block so I searched for a way how to do it, I found a Django app 
on github  called django-jsrender but unfortunately, there isn't enough 
documentation for this app and when I tried to use it I couldn't and this 
is my code: 

[image: Capture.PNG] 

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a1c20606-bf66-4638-a006-be592a938c66%40googlegroups.com.