title: How does Django models interact with non-Django files
body: <p>I am new to Django and am learning by doing.</p>
  
  <p>My original web app only used <code>view.py</code>,<code>base.html</code> and a non-Django python file <code>es.py</code> to connect to a NoSQL database(Elasticsearch) to search over index B. I do most of the front-end in <code>base.html</code>.</p>
  
  <p>The app now need to have some dependent drop down based on fields in index A and then enable search over index B filtered by the selected value. So the values need to be somewhat "global".</p>
  
  <p>A snippet of 
  <code>base.html</code> for the new selection function</p>
  
  <pre><code>&lt;form class="indexA-selection"&gt;
   &lt;input list="site"&gt;
  &lt;datalist id="site"&gt;
    &lt;option value="aa"&gt;
    &lt;option value="bb"&gt;
    &lt;option value="cc"&gt;
    &lt;option value="dd"&gt;
  &lt;/datalist&gt;
      &lt;button class="btn" type="submit"&gt;Show Result&lt;/button&gt;
    &lt;/form&gt;
  &lt;br&gt;
    &lt;form class="form-inline"&gt;
  
      &lt;input 
      class="form-control mr-sm-2" 
      type="query" placeholder="query" 
      aria-label="query"
      name = 'query'
      value = ""&gt;
      &lt;button class="btn" type="submit"&gt;Search&lt;/button&gt;
    &lt;/form&gt;
  </code></pre>
  
  <p><code>views.py</code></p>
  
  <pre><code>def search_index(request):
      results = []
      search_term = ""
      v_site=""
      if request.GET.get('query'):
          search_term = request.GET['query'] #this is the original search
      if request.GET.get('site'):
          v_site = request.GET['site']  
      print(v_site)   #no value gets printed,so I don't think value in html is passed
      allcate=categories(v_site) #function from non-Django py file.
       #If v_site is passed, this will return a nested dictionary for dependent drop-downs 
      print(allcate)
      results = esearch(query=search_term) #function from non-Django py file
      print(results)
      context = {'results': results, 'count': len(results), 'search_term': search_term,'allcate':allcate}
      return render(request, 'esearch/index.html', context) 
  </code></pre>
  
  <p>I was trying to create select/drop down but it seems Django does not support them in <code>.html</code>. I searched and found it seems that I have to use <code>models.py</code>. </p>
  
  <p>I read some examples and can't find how <code>models.py</code> interact with non-Django python files. </p>
  
  <p>Is there an example that illustrates this? What's the easiest way to enable the structure for the project? Thanks.</p>