What is the advantage of Class-Based views?

后端 未结 5 387
-上瘾入骨i
-上瘾入骨i 2020-12-12 11:19

I read today that Django 1.3 alpha is shipping, and the most touted new feature is the introduction of class-based views.
I\'ve read the relevant documentation, but I fi

5条回答
  •  甜味超标
    2020-12-12 12:02

    If self.args[0] is bothering you, the alternative is:

    urlpatterns = patterns('books.views',
        url(r'^books/(?P\w+)/$', 'publisher_books_list', name="publisher_books_list"),
    )
    

    Then you could use self.kwargs['slug'] instead, making it slightly more readable.

提交回复
热议问题