You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-1Lines changed: 21 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,27 @@ Then, in your main page template:
40
40
</html>
41
41
```
42
42
43
-
That's it!
43
+
### Optional: aliasing templates
44
+
45
+
If you find writing out the full template path every time you use a component too verbose, you can define a dictionary of "aliases" in your Django settings, using the setting name `WRAPWITH_TEMPLATES`. This dictionary can be nested. You can then use a dotted path into this dictionary in your templates.
46
+
47
+
In your `settings.py`:
48
+
49
+
```python
50
+
WRAPWITH_TEMPLATES= {
51
+
"wrappers": {
52
+
"box": "wrappers/box.html",
53
+
},
54
+
}
55
+
```
56
+
57
+
In your template:
58
+
59
+
```html
60
+
{% wrapwith wrappers.box with bordercol="red" %}
61
+
<p>this is inside a red box</p>
62
+
{% endwrapwith %}
63
+
```
44
64
45
65
Tested on Python 3 with all currently supported Django versions.
0 commit comments