On 27-Mar-09, at 11:44 AM, Ross wrote:

>
> I'm a bit new to this, so don't be surprised if I'm way off base here.
>
> Is there any way for me to deliver a javascript that contains
> templated content through Django?  Or is Django somehow limited to
> only rendering html content based templates.
>
> So I'm thinking I'd have an html page which contains a:
>
> script type='application/x-javascript' src='deliverJS/'
>
> and my urls.py would trap the 'deliverJS/' and call something like
> views.makeJS
>
> and in views.py I'd gather some stuff and render a file  'jsFile.js'
> into which I've stuffed some things using template tags?
>
> Is that possible?

In short yes, that's pretty much how you'd do it. Just make sure to  
send the correct mime-type to the response as well:

http://docs.djangoproject.com/en/dev/ref/request-response/#httpresponse-objects
--
   Andy McKay
   Clearwind Consulting: www.clearwind.ca
   Blog: www.agmweb.ca/blog/andy
   Twitter: twitter.com/clearwind


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to