Hi Nick, I'm not sure what kind of generation are you suggesting. What I've
used a couple of times is creating a template tag to convert a json-like
data structure in the context to a javascript object, so in the template I
have something like this in a <script> tag:

var foo = {% foo|to_json %}; /* foo comes from python context typically a
compelx nexted dict/list */
// code that uses the data in foo

Are you suggesting something like this or something different?



On 11 October 2016 at 14:33, Nick Sarbicki <nick.a.sarbi...@gmail.com>
wrote:

> Hi Everyone,
>
> We were tasked at work some time ago with tidying up a legacy Django
> project. Part of the projects JS relied heavily on Django variables and
> settings and we were seeing frequent large variable JSON dumps in the
> templates.
>
> We cleaned this up and ended up designing a small package which allowed us
> to generate Javascript files through the Django templating engine when
> requested by the client.
>
> Since then we've started finding ourselves thinking about using this
> package more and more.
>
> So I was wondering, is this something that the community would be
> interested in? It's not open source yet but we're considering opening up
> the particular package (not least so its more available for us).
>
> If it's not at all of interest, why? Is there a big disadvantage to
> generating Javascript through the templating engine? (assume you, and not
> the client, control the variables going in.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-developers/04d4d42d-3bfa-47c6-9ac7-
> e9d801de9286%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/04d4d42d-3bfa-47c6-9ac7-e9d801de9286%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel F. Moisset - UK Country Manager
www.machinalis.com
Skype: @dmoisset

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CALuYSZXsojot-h7sQ4hpRg6UU4Mqjj6HUtfhzzqNoKamRUheTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to