Django get() takes exactly 2 arguments (3 given)
Question: I am trying to use DetailView generic class in my test app and this is what I
have in my view

*_updated model *_ from this [example](http://docs.djangoproject.com/en/1.3/topics/class-based-views/#adding-extra-context)
    
    
    class AuthorDetailView(DetailView):
    
         context_object_name = "author"
         queryset = Author.objects.all()
         slug_field = "id"
    
    
        def get_object(self):
            object = super(AuthorDetailView, self).get_object()
    
            return object
    

as a test

and in my urls.py file I got

    
    
    ('^author/(\d+)/$', Author.AuthorDetailView.as_view()),
    

when I navigate to <http://localhost:8000/author/1> I get the following error

Typer Error get() takes exactly 2 arguments (3 given)

    
    
    Traceback:
    File "/Library/Python/2.6/site-packages/django/core/handlers/base.py" in get_response
      111.                         response = callback(request, *callback_args, **callback_kwargs)
    File "/Library/Python/2.6/site-packages/django/views/generic/base.py" in view
      47.             return self.dispatch(request, *args, **kwargs)
    File "/Library/Python/2.6/site-packages/django/views/generic/base.py" in dispatch
      68.         return handler(request, *args, **kwargs)
    
    Exception Type: TypeError at /author/1/
    Exception Value: get() takes exactly 2 arguments (3 given)
    

I don't really understand what is going on in base.py.


Answer: Try this urlconf

    
    
    from books.views import AuthorDetailView
    
    urlpatterns = patterns('',
        #...
        (r'^authors/(?P<pk>\d+)/$', AuthorDetailView.as_view()),
    )
    

and navigate to:

    
    
    http://localhost:8000/author/1/
    

