<script type="text/javascript">
    
    $(function(){  
        //attach autocomplete  
        $('input#id_filtered_positions').autocomplete({  
  			
  		   appendTo: "#add-table-elem-dialog",
           //define callback to format results  
           source: function(req, add){  
                //pass request to server  
                $.getJSON(ajax_position_lookup, req, function(data) {  
                    //create array for response objects  
                    var suggestions = [];  
                    $.each(data['result'], function(i, val){  
                      suggestions.push(val[0]);  
                });  
  
                //pass array to callback  
                add(suggestions);  
            });  
          },  
  
        });  
    }); 
    
</script>


<form class="position-add-form" method="post"> {% csrf_token %}
  {{ form.as_p }}
  <p class="lexeme-save">
    <button type="submit" id="add-position-submit">
      Zapisz
    </button>
    <button type="reset" id="add-position-cancel">
      Anuluj
    </button>
  </p>
</form>
