title: Django Class Based View CreateView url resolution
body: <p>I am fairly new to CBV and am trying to make sense of it. I copied the following example from the django doc page:</p>
  
  <p><a href="https://docs.djangoproject.com/en/dev/topics/class-based-views/generic-editing/" rel="nofollow">https://docs.djangoproject.com/en/dev/topics/class-based-views/generic-editing/</a></p>
  
  <h1>models.py</h1>
  
  <pre><code>from django.core.urlresolvers import reverse
  from django.db import models
  
  class Author(models.Model):
      name = models.CharField(max_length=200)
  
      def get_absolute_url(self):
          return reverse('author-detail', kwargs={'pk': self.pk})
  </code></pre>
  
  <h1>views.py</h1>
  
  <pre><code>from django.views.generic.edit import CreateView, UpdateView, DeleteView
  from django.core.urlresolvers import reverse_lazy
  from myapp.models import Author
  
  class AuthorCreate(CreateView):
      model = Author
      fields = ['name']
  
  class AuthorUpdate(UpdateView):
      model = Author
      fields = ['name']
  
  class AuthorDelete(DeleteView):
      model = Author
      success_url = reverse_lazy('author-list')
  </code></pre>
  
  <h1>urls.py</h1>
  
  <pre><code>from django.conf.urls import patterns, url
  from myapp.views import AuthorCreate, AuthorUpdate, AuthorDelete
  
  urlpatterns = patterns('',
      # ...
      url(r'author/add/$', AuthorCreate.as_view(), name='author_add'),
      url(r'author/(?P&lt;pk&gt;\d+)/$', AuthorUpdate.as_view(), name='author_update'),
      url(r'author/(?P&lt;pk&gt;\d+)/delete/$', AuthorDelete.as_view(), name='author_delete'),
  )
  </code></pre>
  
  <p>At author/add/ I indeed get the form, but when I enter the string I get the following error:</p>
  
  <pre><code>Reverse for 'author-detail' with arguments '()' and keyword arguments '{'pk': 3}' not found.
  </code></pre>
  
  <p>It seems like the new entry has been added to the database, but it could not resolve the URL for the next view?</p>
  
  <p>So I am puzzled, what is this get_absolute_url() object's method supposed to do, how does it work (I could not grasp it from the django doc) and how do I fix the issue?
  Thanks.</p>
  
  <p>EDIT 1: added the template:</p>
  
  <p>author_form.html:</p>
  
  <pre><code>&lt;form action="" method="post"&gt;{% csrf_token %}
      {{ form.as_p }}
      &lt;input type="submit" value="Create" /&gt;
  &lt;/form&gt;
  </code></pre>