Skip to content

Commit 93f09a5

Browse files
committed
update flask examples descriptions
1 parent 483f320 commit 93f09a5

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

content/pages/examples/flask/flask-templating-render-template-string.markdown

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@ sidebartitle: flask.templating render_template_string
77
meta: Python example code that shows how to use the render_template_string callable from the flask.templating module of the Flask project.
88

99

10-
render_template_string is a callable within the flask.templating module of the Flask project.
10+
[render_template_string](https://github.com/pallets/flask/blob/master/src/flask/templating.py)
11+
is a [Flask](/flask.html) function from the `flask.templating` package.
12+
`render_template` is used to generate output from a string
13+
that is passed in rather than from a file in the templates folder.
14+
15+
Note that `render_template_string` is sometimes imported from the `flask`
16+
package instead of from `flask.templating`. It is the same function that is
17+
imported, but there are less characters to type when you leave off
18+
the `.templating` part.
19+
Understanding the following concepts are useful when coding projects that use `render_template_string`:
20+
21+
22+
* [template engines](/template-engines.html), specifically [Jinja2](/jinja2.html)
23+
* [Flask](/flask.html) and the concepts for [web frameworks](/web-frameworks.html)
1124

1225

1326
## Example 1 from Flask-User

content/pages/examples/flask/flask-templating-render-template.markdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ Note that `render_template` is typically imported directly from the `flask`
1717
package instead of from `flask.templating`. It is the same function that is
1818
imported, but there are less characters to type when you leave off
1919
the `.templating` part.
20+
Understanding the following concepts are useful when coding projects that use `render_template`:
21+
22+
23+
* [template engines](/template-engines.html), specifically [Jinja2](/jinja2.html)
24+
* [Flask](/flask.html) and the concepts for [web frameworks](/web-frameworks.html)
2025

2126

2227
## Example 1 from Braintree Flask app

content/pages/examples/flask/flask-views-methodview.markdown

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ sidebartitle: flask.views MethodView
77
meta: Example code for understanding how to use the MethodView class from the flask.views module of the Flask project.
88

99

10-
MethodView is a class within the flask.views module of the Flask project.
10+
[MethodView](https://github.com/pallets/flask/blob/master/src/flask/views.py)
11+
is a class within the `flask.views` module of the [Flask](/flask.html)
12+
project. `MethodView` is a
13+
[Python Metaclass](https://stackoverflow.com/questions/100003/what-are-metaclasses-in-python)
14+
that determines the methods, such as GET, POST, PUT, etc, that
15+
a view defines.
1116

1217

1318
## Example 1 from FlaskBB

content/pages/examples/flask/flask-views-view.markdown

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ sidebartitle: flask.views View
77
meta: Example code for understanding how to use the View class from the flask.views module of the Flask project.
88

99

10-
View is a class within the flask.views module of the Flask project.
10+
[View](https://github.com/pallets/flask/blob/master/src/flask/views.py)
11+
is a class within the `flask.views` module of the [Flask](/flask.html)
12+
project. `View` provides an alternative way to use view functions
13+
by subclassing this class and implementing `dispatch_request`
14+
for the routing system. This is typically only used in more advanced
15+
situations such as extending the Flask source code, rather than
16+
a standard way of interacting with the framework.
1117

1218

1319
## Example 1 from FlaskBB

0 commit comments

Comments
 (0)