title: Seeking complete example of class based views crud, including template
body: <p>Django 1.3 documentation on class based views is seeming like a treasure hunt. How to write the class is clear enough... but what kind of template code matches each generic class? Would someone provide a <em>complete</em> example soup to nuts? Here's what I have so far:</p>
  
  <h2>urls.py</h2>
  
  <pre><code>(r'^brand_create2$',    BrandCreate.as_view()),
  </code></pre>
  
  <h2>views.py</h2>
  
  <pre><code>from django.views.generic import CreateView
  @login_required
  class BrandCreate(CreateView):
      template_name       = 'generic_form_popup.html'
      context_object_name = "brand_thingie"
      #queryset            = models.Brand.objects.all()
      success_url         = '/'
  </code></pre>
  
  <h2>generic_form_popup.html</h2>
  
  <pre><code>????
  </code></pre>
  
  <hr>
  
  <p>In this case I'm exploring if it is worth learning the new style, given the older style still works:</p>
  
  <h2>urls.py</h2>
  
  <pre><code>url(r'^brand_create1$', 'coat.views.brand_create'),
  </code></pre>
  
  <h2>views.py</h2>
  
  <pre><code>class formBrand(forms.ModelForm):
      class Meta:
          model = models.Brand
          exclude = ('')
  
  @login_required
  def brand_create(request):
  
      form = formBrand
      if request.method == 'POST':
          form = formBrand(request.POST)
          if form.is_valid():
              form.save()
              return HttpResponseRedirect('/')
  
      passed = dict(
          form=form,
          MEDIA_URL  = settings.MEDIA_URL,
          STATIC_URL = settings.STATIC_URL)
      return render_to_response('generic_form_popup.html',
      passed, context_instance=RequestContext(request))
  </code></pre>
  
  <h2>generic_form_popup.html</h2>
  
  <pre><code>{% extends 'head-plain.html' %}
  {% block title %}{% endblock %}
  {% block headstuff %}{% endblock %}
  {% block content %}   
  &lt;form action="{{ action }}" method="post"&gt;
  {% csrf_token %}{{ form.as_p }}
  &lt;input type="submit" value="Submit" /&gt; &lt;/form&gt;    
  {% endblock %}
  </code></pre>