Skip to content

Commit 04400bf

Browse files
1 parent 0f764bf commit 04400bf

File tree

1 file changed

+14
-0
lines changed
  • template_versioned_docs/version-django_v3.x.x/django

1 file changed

+14
-0
lines changed

template_versioned_docs/version-django_v3.x.x/django/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,17 @@ Hello, World!<br /><br />Greetings from Fiber Team
181181
</body>
182182
</html>
183183
```
184+
185+
### Important Information on Template Data Binding
186+
187+
When working with Pongo2 and this template engine, it's crucial to understand the specific rules for data binding. Only keys that match the following regular expression are supported: `^[a-zA-Z0-9_]+$`.
188+
189+
This means that keys with special characters or punctuation, such as `my-key` or `my.key`, are not compatible and will not be bound to the template. This is a restriction imposed by the underlying Pongo2 template engine. Please ensure your keys adhere to these rules to avoid any binding issues.
190+
191+
If you need to access a value in the template that doesn't adhere to the key naming restrictions imposed by the Pongo2 template engine, you can bind the value to a new field when calling `fiber.Render`. Here's an example:
192+
193+
```go
194+
c.Render("index", fiber.Map{
195+
"Fiber": "Hello, World!\n\nGreetings from Fiber Team",
196+
"MyKey": c.Locals("my-key"),
197+
})

0 commit comments

Comments
 (0)