title: AttributeError: type object 'Project' has no attribute '_meta'
body: <p>I encountered the following in my Django files when I attempt to use the class based view <code>CreateView</code>.</p>
  
  <pre><code>AttributeError at /overview/new/
  type object 'Project' has no attribute '_meta'
  </code></pre>
  
  <p>I have no idea why the <code>_meta</code> attribute is not there. I inherited my model from models.Model as usual, but I can't find any questions that have the same problem. I posted my files down below, can somebody help me fix this problem?</p>
  
  <p>views.py:</p>
  
  <pre><code>from django.shortcuts import render, redirect
  from django.contrib.auth import logout, authenticate, login
  from django.contrib import messages
  from django.views.generic import ListView, DetailView, CreateView
  from projects.models import Project, Task
  
  class CreateProject(CreateView):
      model = Project
      fields = ['title', 'description']
  
      def form_valid(self, form):
          form.instance.author = self.request.user
          return super().form_valid(form)
  </code></pre>
  
  <p>models.py:</p>
  
  <pre><code>from django.db import models
  from django.contrib.auth.models import User
  from .CustomIDConstructor import ID
  
  
  class Project(models.Model):
      title = models.CharField(max_length=100, default='No title')
      description = models.TextField(default='No description')
      author = models.ForeignKey(User, on_delete=models.CASCADE)
      customid = models.CharField(max_length=30, default=ID, editable=False, primary_key=True)
  
      def __str__(self):
          return self.title
  </code></pre>
  
  <p>urls.py:</p>
  
  <pre><code>from django.urls import path
  from . import views
  from projects.views import ProjectsOverview, Project, CreateProject
  from django.contrib.auth.decorators import login_required
  
  urlpatterns = [
      path('', login_required(views.ProjectsOverview.as_view()), name='projects-projectsoverview'),
      path('project/&lt;pk&gt;/', login_required(views.Project.as_view()), name='projects-project'),
      path('new/', login_required(views.CreateProject.as_view()), name='projects-newproject')
  ]
  </code></pre>
  
  <p>Project_form.html:</p>
  
  <pre><code>{% extends "home/base.html" %}
  {% load crispy_forms_tags %}
  {% block content %}
  &lt;div class="container mt-4"&gt;
      &lt;form method="POST"&gt;
          {% csrf_token %}
          {{ form|crispy }}
  
          &lt;button style="background-color:rgb(130, 130, 130); color:white; border: none" class="btn btn-outline-info" type="submit"&gt;Create new project&lt;/button&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  {% endblock content %}
  </code></pre>
  
  <p>Full traceback:</p>
  
  <pre><code>Internal Server Error: /overview/new/
  Traceback (most recent call last):
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
      response = get_response(request)
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py", line 126, in _get_response
      response = self.process_exception_by_middleware(e, request)
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py", line 124, in _get_response
      response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\auth\decorators.py", line 21, in _wrapped_view
      return view_func(request, *args, **kwargs)
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\views\generic\base.py", line 68, in view
      return self.dispatch(request, *args, **kwargs)
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\views\generic\base.py", line 88, in dispatch
      return handler(request, *args, **kwargs)
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\views\generic\edit.py", line 168, in get
      return super().get(request, *args, **kwargs)
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\views\generic\edit.py", line 133, in get
      return self.render_to_response(self.get_context_data())
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\views\generic\edit.py", line 66, in get_context_data
      kwargs['form'] = self.get_form()
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\views\generic\edit.py", line 32, in get_form
      form_class = self.get_form_class()
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\views\generic\edit.py", line 101, in get_form_class
      return model_forms.modelform_factory(model, fields=self.fields)
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\forms\models.py", line 551, in modelform_factory
      return type(form)(class_name, (form,), form_class_attrs)
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\forms\models.py", line 256, in __new__
      apply_limit_choices_to=False,
    File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\forms\models.py", line 139, in fields_for_model
      opts = model._meta
  AttributeError: type object 'Project' has no attribute '_meta'
  [05/Mar/2019 14:00:15] "GET /overview/new/ HTTP/1.1" 500 115370
  </code></pre>