Skip to content

Commit 93b6d72

Browse files
committed
More docs
1 parent 92bcec9 commit 93b6d72

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

bolt/bolt/signals/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1-
# signals
1+
# Signals
22

33
Run code when certain events happen.
4+
5+
```python
6+
from bolt.signals import request_finished
7+
8+
9+
def on_request_finished(sender, **kwargs):
10+
print("Request finished!")
11+
12+
13+
request_finished.connect(on_request_finished)
14+
```

bolt/bolt/templates/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Templates
2+
3+
Render HTML templates using Jinja.
4+
5+
Templates are typically rendered in `TemplateViews`,
6+
but you can also render them directly to strings for emails or other use cases.
7+
8+
```python
9+
from bolt.templates import Template
10+
11+
12+
Template("comment.md").render({
13+
"message": "Hello, world!",
14+
})
15+
```
16+
17+
Template files can be located in either a root `app/templates`,
18+
or the `templates` directory in any installed packages.
19+
20+
[Customizing Jinja](./jinja/README.md)

bolt/bolt/templates/jinja/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Templates
2-
3-
Render templates using Jinja2.
1+
# Jinja
42

53
Templates can be stored inside `INSTALLED_PACKAGES` (ex. `app/<pkg>/templates`) or in the `templates` directory at the root of your project (ex. `app/templates`).
64

@@ -11,6 +9,9 @@ which the whole app depends on.
119

1210
### Package templates
1311

12+
Since all template directories are effectively "merged" together,
13+
packages will typically namespace their own templates such as `app/users/templates/users/delete.html`.
14+
1415
## Jinja
1516

1617
There is a default set of globals, filters, and extensions.

0 commit comments

Comments
 (0)