On Tue, Oct 15, 2013 at 9:54 AM, Scot Hacker <[email protected]> wrote:
> > > On Tuesday, October 15, 2013 8:45:09 AM UTC-7, [email protected] wrote: >> >> >>> >> You can embed js anywhere in your template, e.g.: >> >> {% for shbf in should_have_found_list %} >> <script type="text/javascript"> >> my_js_function(shbf); >> </script> >> {% endfor %} >> > > I think you meant to write: > > my_js_function({{shbf}}); > Yes - not enough coffee yet. > > Another take on this, should you need it, is to send JSON directly over > from the django view or model method into the template. Here's how I solved > that recently: > > importance_options = > json.dumps(dict(BundleNode.importance_options)) > > That will convert a Django queryset into a JSON object. Then, in your JS > template, something like: > > var $options_obj = {{importance_options|safe}}; > > Season to taste. > > ./s > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACwCsY7XAenh%2BTVJzwceGFsNhiku5_7p%2BH-8%2BmuSnKO2pL7mrw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.

