title: Django "if request.method == 'POST':" fails
body: <p>Hi have a strange problem in my new Django project. </p>
  
  <p>I'm testing basically the <em>NameForm</em> example from the <a href="https://docs.djangoproject.com/en/1.6/topics/forms/" rel="nofollow">Django Documentation Working with Froms</a>. It seems to be an easy one but somehow when I try to submit some name nothing happens even not a page reload.</p>
  
  <p><strong>form.py</strong></p>
  
  <pre><code>from django import forms
  
  class NameForm(forms.Form):
       your_name = forms.CharField(label='Your name', max_length=100)
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>from django.shortcuts import render
  from django.http import HttpResponseRedirect
  from groupbuilder import forms
  
  def GroupBuilder(request):
      if request.method == 'POST':
          form = forms.NameForm(request.POST)
          if form.is_valid():
              return HttpResponseRedirect('/thanks/')
  
      else:
          form = forms.NameForm()
  
  
      return render(request, 'groupbuilder.html', {'form': form})
  </code></pre>
  
  <p><strong>the template:</strong></p>
  
  <pre><code>    &lt;form action="/your-name/" method="post"&gt;
            {% csrf_token %}
            { form.as_p }}
            &lt;input type="submit" value="Submit" /&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p><strong>setting.py</strong></p>
  
  <pre><code>"""
  Django settings for crossLFG project.
  
  For more information on this file, see
  https://docs.djangoproject.com/en/1.6/topics/settings/
  
  For the full list of settings and their values, see
  https://docs.djangoproject.com/en/1.6/ref/settings/
  """
  
  # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  import os
  from django.utils.translation import ugettext_lazy as _
  
  TEMPLATE_CONTEXT_PROCESSORS = (
      "django.contrib.auth.context_processors.auth",
      "django.core.context_processors.debug",
      "django.core.context_processors.i18n",
      "django.core.context_processors.media",
      "django.core.context_processors.static",
      "django.core.context_processors.tz",
      "django.contrib.messages.context_processors.messages",
      #"frontpage.context_processors.contactform",
  )
  
  
  DEBUG = True
  TEMPLATE_DEBUG = DEBUG
  
  ADMINS = (
      # ('Your Name', 'your_email@example.com'),
  )
  
  MANAGERS = ADMINS
  
  BASE_DIR = os.path.dirname(os.path.dirname(__file__))
  PROJECT_PATH = '/home/KBrothers/crossLFG/'
  TEMPLATE_PATH = os.path.join(PROJECT_PATH, 'templates')
  STATIC_PATH = os.path.join(PROJECT_PATH,'static')
  STATIC_URL = '/static/'
  DATABASE_PATH = os.path.join(PROJECT_PATH,'users.db')
  #LOCALE_PATHS = os.path.join(PROJECT_PATH, 'locale',)
  LOCALE_PATHS = ('/home/KBrothers/crossLFG/locale',)
  
  
  
  # Quick-start development settings - unsuitable for production
  # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
  
  # SECURITY WARNING: keep the secret key used in production secret!
  SECRET_KEY = ****
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = True
  
  CRISPY_TEMPLATE_PACK = 'bootstrap3'
  
  ALLOWED_HOSTS = []
  
  
  # Application definition
  
  INSTALLED_APPS = (
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'accounts',
      'main_app',
      'groupbuilder',
  
      'crispy_forms',
  
  )
  
  
  
  TEMPLATE_LOADERS = (
      'django.template.loaders.filesystem.Loader',
      'django.template.loaders.app_directories.Loader',
  #     'django.template.loaders.eggs.Loader',
  )
  
  TEMPLATE_DIRS = (
      os.path.join(PROJECT_PATH, 'templates'),
      os.path.join(PROJECT_PATH, 'main_app/templates'),
      os.path.join(PROJECT_PATH, 'accounts/templates'),
      os.path.join(PROJECT_PATH, 'groupbuilder/templates'),
  
  )
  
  MIDDLEWARE_CLASSES = (
       'django.contrib.sessions.middleware.SessionMiddleware',
      'django.middleware.locale.LocaleMiddleware',
      'django.middleware.common.CommonMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
      'django.middleware.clickjacking.XFrameOptionsMiddleware',
      # Uncomment the next line for simple clickjacking protection:
      'django.middleware.clickjacking.XFrameOptionsMiddleware',
  
  )
  
  ROOT_URLCONF = 'crossLFG.urls'
  
  WSGI_APPLICATION = 'crossLFG.wsgi.application'
  
  
  # Database
  # https://docs.djangoproject.com/en/1.6/ref/settings/#databases
  
  MAIL_USE_TLS = True
  EMAIL_HOST = '****'
  EMAIL_PORT = ****
  EMAIL_HOST_USER = '********'
  EMAIL_HOST_PASSWORD = '********'
  
  #CRISPY_TEMPLATE_PACK = 'bootstrap3'
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
          'NAME': DATABASE_PATH,                      # Or path to database file if using sqlite3.
          # The following settings are not used with sqlite3:
          'USER': '',
          'PASSWORD': '',
          'HOST': '',                      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
          'PORT': '',                      # Set to empty string for default.
      }
  }
  
  # Internationalization
  # https://docs.djangoproject.com/en/1.6/topics/i18n/
  LANGUAGE_CODE = 'en'
  #LANGUAGE_CODE = 'de'
  #LANGUAGE_CODE = 'fr'
  LANGUAGE_COOKIE_NAME = 'wm_lang'
  TIME_ZONE = 'UTC'
  
  LANGUAGES = (
  
      ('en', _('English')),
      #('de', _('German')),
      #('fr', _('French')),
  )
  
  
  
  
  
  
  
  USE_I18N = True
  
  USE_L10N = True
  
  USE_TZ = True
  
  
  # Static files (CSS, JavaScript, Images)
  # https://docs.djangoproject.com/en/1.6/howto/static-files/
  </code></pre>
  
  <p>The strange thing is if I put </p>
  
  <pre><code>return HttpResponseRedirect('/thanks/')
  </code></pre>
  
  <p>right after the "else" in the </p>
  
  <pre><code>if request.method == 'POST':
  </code></pre>
  
  <p>statement, I can't even fill out the form when I try to visit the form URL. It takes my directly to /thanks/. So the request.method check always fails.</p>
  
  <p>What do I miss??</p>