Skip to content
Myr

Merge pull request #262 from SimonSapin/patch-1

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Typo fix in code samples for Pluggable Views doc.

authored by Armin Ronacher · committed by Armin Ronacher · parents 284025f, 0ff7fe2 · Browse files · 1 file+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:docs/views.rst+3 added-3 removed
84 unmodified lines
85 return render_template(self.template_name)8687And then you can register it like this::8889 app.add_url_view('/about', RenderTemplateView.as_view(89 app.add_url_rule('/about', view_func=RenderTemplateView.as_view(90 'about_page', template_name='about.html'))9192Method Hints93------------
13 unmodified lines
107 if request.method == 'POST':108 ...109 ...110111 app.add_url_view('/myview', MyView.as_view('myview'))111 app.add_url_rule('/myview', view_func=MyView.as_view('myview'))112113Method Based Dispatching114------------------------115
13 unmodified lines
129 def post(self):130 user = User.from_form_data(request.form)131 ...132133 app.add_url_view('/users/', UserAPI.as_view('users'))133 app.add_url_rule('/users/', view_func=UserAPI.as_view('users'))134135That way you also don't have to provide the136:attr:`~flask.views.View.methods` attribute. It's automatically set based137on the methods defined in the class.