Dango notes II: class-based views

  • A view is a callable which takes a request and returns a response.
  • A view can be function (function-based view) or a class (class-based view).
  • Class-based views allow you to structure your views and reuse code by harnessing inheritance and mixins.
  • There are two ways to configure or set class attributes:
    • to subclass and to override attributes and method in the subclass, and
    • to configure class attributes as keyword arguments to the as_view() call in the URLconf.
posted @ 2017-08-09 17:22  Pat  阅读(133)  评论(0)    收藏  举报