Fix doc “Class based views”.

- Remove the as_view method.
This commit is contained in:
Mellcap 2017-01-10 15:59:31 +08:00
parent b0bf989056
commit 2fd9aaf17c

View File

@ -28,7 +28,7 @@ class SimpleView(HTTPMethodView):
def delete(self, request): def delete(self, request):
return text('I am delete method') return text('I am delete method')
app.add_route(SimpleView.as_view(), '/') app.add_route(SimpleView(), '/')
``` ```
@ -40,7 +40,7 @@ class NameView(HTTPMethodView):
def get(self, request, name): def get(self, request, name):
return text('Hello {}'.format(name)) return text('Hello {}'.format(name))
app.add_route(NameView.as_view(), '/<name>') app.add_route(NameView(), '/<name>')
``` ```
@ -53,6 +53,6 @@ class ViewWithDecorator(HTTPMethodView):
def get(self, request, name): def get(self, request, name):
return text('Hello I have a decorator') return text('Hello I have a decorator')
app.add_route(ViewWithDecorator.as_view(), '/url') app.add_route(ViewWithDecorator(), '/url')
``` ```