title: Very simple user input in django
body: <p>My underlying struggle is I am having trouble understanding how django templates, views, and urls are tied together... What is the simplest, bare minimum way to prompt the user to input a string, then use that string to query a database (preferably w/ python model not raw sql queries)? Should I use GET and POST methods? Should I use a form? Do I need to use a template or can I use a generic view?  </p>
  
  <p>when i try submitting input it just reloads the input page.</p>
  
  <p>views.py: </p>
  
  <pre><code>from django.shortcuts import render
  from django.shortcuts import HttpResponse
  from People.models import Person
  
  def index(request):
      return render(request, 'People/index.html')
  
  def search(request):
      search_id = request.POST.get('textfield', None)
      try:
          user = Person.objects.get(MAIN_AUTHOR = search_id)
          #do something with user
          html = ("&lt;H1&gt;%s&lt;/H1&gt;", user)
          return HttpResponse(html)
      except Person.DoesNotExist:
          return HttpResponse("no such user")  
  </code></pre>
  
  <p>urls.py</p>
  
  <pre><code>from django.conf.urls import patterns, include, url
  
  from django.contrib import admin
  admin.autodiscover()
  
  urlpatterns = patterns('',
      url(r'^admin/', include(admin.site.urls)),
      url(r'^People/', 'People.views.index'), 
      url(r'^People/send/', 'People.views.search'),
  )
  </code></pre>
  
  <p>template: </p>
  
  <pre><code>&lt;form method="POST" action="send/"&gt;
  {% csrf_token %}
  &lt;input type="text" name="textfield"&gt;
  
  &lt;button type="submit"&gt;Upload text&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Am I missing something or doing something wrong?</p>