title: is it possible to use javascript to get data from django models db?
body: <p>I am trying to get the django model object to show on a html page. Of course when I tried to use {{ object }}, I get an error.</p>
  
  <p>How do I properly get the django data model and manipulate the attributes using javascript?</p>
  
  <p>the url:</p>
  
  <pre><code>('^all_companies$', 'companies.views.all_companies')
  </code></pre>
  
  <p>the view:</p>
  
  <pre><code>def all_companies(request): 
      companies = Company.objects.all().order_by('id')[:5];   
      return direct_to_template(request, 'all_companies.html', {'companies': companies} );
  </code></pre>
  
  <p>the html:</p>
  
  <pre><code>{% block sidebar %}
      &lt;div id="sidebar"&gt;
          &lt;!-- like google maps, short list of company info --&gt;
          &lt;ul&gt;
              {% for comp in companies %}
                  &lt;li&gt;{{ comp }}&lt;/li&gt;                 
              {% endfor %}
          &lt;/ul&gt;
      &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>the js:</p>
  
  <pre><code>var tmp = {{ companies }}
  </code></pre>