title: Django Createview for generic Model
body: <p>I've been searching really hard for this, and i can't find it anywhere. So, here it goes:</p>
  
  <p>I'm trying to build an generic class that takes a generic Model as parameter and creates a form for it. For this i'm using Django's ModelForm and CreateView classes. The main goal to this, is when i need to create a new form, i just declare a new URL passing the Model name.</p>
  
  <h2>urls.py</h2>
  
  <pre><code>url(r'^create', GenericCreate(model=Author).as_view(), name='create'),
  </code></pre>
  
  <h2>views.py</h2>
  
  <pre><code>class GenericCreate(CreateView):
  
      def __init__(self, model, *args, **kwargs):
          super(GenericCreate, self).__init__(*args, **kwargs)
          self.form_class = to_modelform(self.model)
  </code></pre>
  
  <p>to_modelform is a function that i implemented that converts a model to a modelform, and it works.</p>
  
  <p>This gives me the following error:</p>
  
  <p><strong>AttributeError at /create
  This method is available only on the view class.</strong></p>
  
  <p>Thank you in advance!</p>