Re: problem while passing a list of string to javascript in template

2012-12-29 Thread Everest K.C.
Thank you nimesh very much. It worked for me. Masklinn I didn't get your point. Can you please explain? -- With Regards, Everest K.C. BE Computer Engineering Institute of Engineering, Pulchowk Campus URL: http://www.everestkc.com.np -- You received this message because you are subscribed to the

Re: problem while passing a list of string to javascript in template

2012-12-29 Thread Masklinn
On 2012-12-29, at 19:59 , Ryan Blunden wrote: > Django presumes all template variables are "unsafe" by default to prevent XSS > attacks which is why it's encoded the quotes. > > Read up on filters and auto-escaping and you'll be able to figure out the > rest. Realizing that the string serializ

Re: problem while passing a list of string to javascript in template

2012-12-29 Thread nimesh ghelani
use mark_safe: from django.utils.safestring import mark_safe ticks = mark_safe(["a", "b", "c", "d"]) On Saturday, December 29, 2012 9:27:55 PM UTC+5:30, Everest K.C. wrote: > > Hello Everyone, > I have problem while passing a list of string from django views to > javascript template. The quotati

Re: problem while passing a list of string to javascript in template

2012-12-29 Thread Ryan Blunden
Django presumes all template variables are "unsafe" by default to prevent XSS attacks which is why it's encoded the quotes. Read up on filters and auto-escaping and you'll be able to figure out the rest. Cheers, Ryan On 29/12/2012, at 7:57 AM, "Everest K.C." wrote: > Hello Everyone, > I have

problem while passing a list of string to javascript in template

2012-12-29 Thread Everest K.C.
Hello Everyone, I have problem while passing a list of string from django views to javascript template. The quotation mark gets converted into hex and I cannot use it to plot graph using jpplot. I even tried *replace* method of javascript to replace the hex to convert to '. The codes are as fo

javascript in template

2010-07-21 Thread T.L
ok, so I have a very simple test template I have made. What I want it to do is use javascript to run another view inside of this template. I have a view called javaScriptTest and this view returns HttpResponse('javaTest.html). In javaTest.html, I call a small piece of script: In "anotherView" I

Re: JavaScript in template

2007-07-14 Thread skam
On 14 Lug, 23:20, Nathan Ostgard <[EMAIL PROTECTED]> wrote: > If you're using an SVN copy (not 0.96), there is already a context > processor for this. Add 'django.core.context_processors.media' to > TEMPLATE_CONTEXT_PROCESSORS in settings.py and you will be able to use > {{ MEDIA_URL }} in your te

Re: JavaScript in template

2007-07-14 Thread Nathan Ostgard
If you're using an SVN copy (not 0.96), there is already a context processor for this. Add 'django.core.context_processors.media' to TEMPLATE_CONTEXT_PROCESSORS in settings.py and you will be able to use {{ MEDIA_URL }} in your templates. On Jul 14, 6:43 am, skam <[EMAIL PROTECTED]> wrote: > It

Re: JavaScript in template

2007-07-14 Thread skam
It's better to have the MEDIA_URL settings available in the request context. Write your own template context processor, so you could have {{ media_url }}/js/foo.js instead of hardcoding urls in templates. If you need to serve admin media from a separate server or change media directory you'll be a

Re: JavaScript in template

2007-07-14 Thread Przemek Gawronski
Now that was quick! Big thanks! Przemek -- AIKIDO TANREN DOJO - Poland - Warsaw - Mokotow - Ursynow - Natolin info: http://www.tanren.pl/ phone: +4850151 email: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed t

Re: JavaScript in template

2007-07-14 Thread theju
It is better you refer to the Django Documentation on serving static files http://www.djangoproject.com/documentation/static_files/ for greater clarity. Anyways here is the solution below: On Jul 14, 2:47 pm, Przemek Gawronski <[EMAIL PROTECTED]> wrote: > Hi, how do I specify the source of JS scr

JavaScript in template

2007-07-14 Thread Przemek Gawronski
Hi, how do I specify the source of JS scripts in my templates? In my settings.py I've got: MEDIA_ROOT = '/home/django/work/fw/media/' MEDIA_URL = 'http://192.168.1.1' ADMIN_MEDIA_PREFIX = '/media/' In the template (base.html):