Thanks for help. I will try some of these ideas :)

I don't understand why you are JSON encoding form.field_mapping for the 
> fields template variable.
>
This was like that when I got this code. I am just continuing to develop 
this app. 

But accessing should_have_found_list in template has no problems. I have 
separate JS file that contains functions (event handlers for buttons etc.). 
I can't figure out (total newbie in JS :D ) how to access (or pass) 
should_have_found_list there. (Sorry I wasn't clear enough in my first post)

Drakko

otrdiena, 2013. gada 15. oktobris 18:02:43 UTC+2, [email protected] 
rakstīja:
>
> On Tue, Oct 15, 2013 at 9:54 AM, Scot Hacker <[email protected]<javascript:>
> > 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
>>
>>  
>
otrdiena, 2013. gada 15. oktobris 18:02:43 UTC+2, [email protected] 
rakstīja:
>
> On Tue, Oct 15, 2013 at 9:54 AM, Scot Hacker <[email protected]<javascript:>
> > 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
>>
>>  
>
otrdiena, 2013. gada 15. oktobris 18:02:43 UTC+2, [email protected] 
rakstīja:
>
> On Tue, Oct 15, 2013 at 9:54 AM, Scot Hacker <[email protected]<javascript:>
> > 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
>>
>>  
>
otrdiena, 2013. gada 15. oktobris 18:02:43 UTC+2, [email protected] 
rakstīja:
>
> On Tue, Oct 15, 2013 at 9:54 AM, Scot Hacker <[email protected]<javascript:>
> > 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/461b552c-feae-47c6-b9b1-811015e5d1c8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to