title: Django for loop in html<script>
body: <p>I've created a menu where there was originally a hardcoded choice .Im trying to pass some models names into it but it doesnt work . Any ideas what I am doing wrong?</p>
  <p><strong>view</strong></p>
  <pre><code>def map(request):
  
      field_list = models.Field.objects.all()
      context = {
          &quot;field_list&quot;: field_list,
      }
      template = 'agriculture/map.html'
      return render(request, template, context)
  </code></pre>
  <p><strong>map.html</strong></p>
  <pre><code>
  {% for field in field_list %}
      $(&quot;.search_area&quot;).append(new Option(&quot;{{field.friendly_name&quot;)); //friendly name 
  
  {% endfor %}
  </code></pre>