title: django attributeerror type object 'Payment' has no attribute _meta
body: <p>I'm new to Django and I'm trying to create my first simple app.</p>
  
  <p>I want to try out the createView, but I keep getting an error when trying to call the corresponding template.</p>
  
  <p>Here's the error:</p>
  
  <pre><code>Environment:
  
  
  Request Method: GET
  Request URL: http://192.168.2.55:8000/colist/paymentNew/
  
  Django Version: 1.6.2
  Python Version: 2.7.3
  Installed Applications:
  ('django.contrib.admin',
   'django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.messages',
   'django.contrib.staticfiles',
   'polls',
   'colist')
  Installed Middleware:
  ('django.contrib.sessions.middleware.SessionMiddleware',
   'django.middleware.common.CommonMiddleware',
   'django.middleware.csrf.CsrfViewMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware',
   'django.contrib.messages.middleware.MessageMiddleware',
   'django.middleware.clickjacking.XFrameOptionsMiddleware')
  
  
  Traceback:
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
    114.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in view
    69.             return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in dispatch
    87.         return handler(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/views/generic/edit.py" in get
    201.         return super(BaseCreateView, self).get(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/views/generic/edit.py" in get
    159.         form_class = self.get_form_class()
  File "/usr/local/lib/python2.7/dist-packages/django/views/generic/edit.py" in get_form_class
    118.             return model_forms.modelform_factory(model, fields=self.fields)
  File "/usr/local/lib/python2.7/dist-packages/django/forms/models.py" in modelform_factory
    528.     return type(form)(class_name, (form,), form_class_attrs)
  File "/usr/local/lib/python2.7/dist-packages/django/forms/models.py" in __new__
    282.                                       opts.help_texts, opts.error_messages)
  File "/usr/local/lib/python2.7/dist-packages/django/forms/models.py" in fields_for_model
    175.     opts = model._meta
  
  Exception Type: AttributeError at /colist/paymentNew/
  Exception Value: type object 'Payment' has no attribute '_meta'
  </code></pre>
  
  <p>Here is my models.py</p>
  
  <pre><code>from django.db import models
  
  # Create your models here.
  
  class User(models.Model):
      firstName = models.CharField(max_length=50)
      lastName = models.CharField(max_length=50)
      picture = models.ImageField(upload_to='pics/', default='pics/test.jpg')
      email = models.EmailField()
      def __unicode__(self):
              return self.firstName + " " + self.lastName
  
  class Bill(models.Model):
      user = models.ForeignKey(User)
      amount = models.DecimalField(max_digits=8, decimal_places=2)
  
  class Payment(models.Model):
      user = models.ForeignKey(User)
      amount = models.DecimalField(max_digits=8, decimal_places=2)
      newBalance = models.DecimalField(max_digits=8, decimal_places=2)
      date = models.DateTimeField('payment date')    
  </code></pre>
  
  <p>Snippet from views.py</p>
  
  <pre><code>[...other stuff...]
  
  class Payment(ListView):
      model = Payment
      template_name = 'colist/payment.html' 
  
  class PaymentNew(CreateView):
      model = Payment
      template_name = 'colist/paymentNew.html' 
  
      def get_success_url(self):
          return reverse('colist:paymentNew')
  </code></pre>
  
  <p>and the template paymentNew.html</p>
  
  <pre><code>{% load staticfiles %}
  
  &lt;body&gt;
  
  &lt;h1&gt;Payments&lt;/h1&gt;
  
  &lt;ul&gt;
      {% for payment in object_list %}
          &lt;li class="payment"&gt;
              {{ payment.user.firstName }}  {{payment.user.lastName}}   {{payment.amount}} EUR   {{payment.date}}
          &lt;/li&gt;
      {% endfor %}
  &lt;/ul&gt;
  
  
  &lt;form action="{% url 'colist:paymentNew' %}" method="POST"&gt;
      {% csrf_token %}
      &lt;ul&gt;
          {{ form.as_ul }}
      &lt;/ul&gt;
      &lt;input id="save_payment" type="submit" value="Save" /&gt;
  &lt;/form&gt;
  &lt;a href= "{% url "colist:payment" %}"&gt; back to list &lt;/a&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p>I don't know where the "_meta" attribute should come from.
  Also I noticed, when playing around with this error: If I change the model in views.py for the model "Bill" instead of "Payment" like so:</p>
  
  <pre><code>class PaymentNew(CreateView):
      model = Bill
      template_name = 'colist/paymentNew.html' 
  
      def get_success_url(self):
          return reverse('colist:paymentNew')
  </code></pre>
  
  <p>Why is it working with Bill instead of Payment? I don't see any big difference between the two.</p>
  
  <p>Thank you for your help!</p>