Skip to content

Commit

Permalink
More docs
Browse files Browse the repository at this point in the history
  • Loading branch information
davegaeddert committed Jun 22, 2024
1 parent 92bcec9 commit 93b6d72
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
13 changes: 12 additions & 1 deletion bolt/bolt/signals/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# signals
# Signals

Run code when certain events happen.

```python
from bolt.signals import request_finished


def on_request_finished(sender, **kwargs):
print("Request finished!")


request_finished.connect(on_request_finished)
```
20 changes: 20 additions & 0 deletions bolt/bolt/templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Templates

Render HTML templates using Jinja.

Templates are typically rendered in `TemplateViews`,
but you can also render them directly to strings for emails or other use cases.

```python
from bolt.templates import Template


Template("comment.md").render({
"message": "Hello, world!",
})
```

Template files can be located in either a root `app/templates`,
or the `templates` directory in any installed packages.

[Customizing Jinja](./jinja/README.md)
7 changes: 4 additions & 3 deletions bolt/bolt/templates/jinja/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Templates

Render templates using Jinja2.
# Jinja

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`).

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

### Package templates

Since all template directories are effectively "merged" together,
packages will typically namespace their own templates such as `app/users/templates/users/delete.html`.

## Jinja

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

0 comments on commit 93b6d72

Please sign in to comment.